From: Saleem Abdulrasool Date: Tue, 28 May 2019 18:26:00 +0000 (+0000) Subject: Driver: support `/Zc:char8_t` and `/Zc:char8_t-` X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d92c93a0dc7340bdac89687926443653269b3864;p=clang Driver: support `/Zc:char8_t` and `/Zc:char8_t-` Update the `cl` emulation to support the `/Zc:char8_t[-]?` options as per the MSVC 2019.1 toolset. These are aliases for `-fchar8_t` and `-fno-char8_t`. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@361859 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/docs/UsersManual.rst b/docs/UsersManual.rst index 88cb72c9b6..c9195e9082 100644 --- a/docs/UsersManual.rst +++ b/docs/UsersManual.rst @@ -3051,6 +3051,8 @@ Execute ``clang-cl /?`` to see a list of supported options: /Yc Generate a pch file for all code up to and including /Yu Load a pch file and use it instead of all code up to and including /Z7 Enable CodeView debug information in object files + /Zc:char8_t Enable C++2a char8_t type + /Zc:char8_t- Disable C++2a char8_t type /Zc:dllexportInlines- Don't dllexport/dllimport inline member functions of dllexport/import classes /Zc:dllexportInlines dllexport/dllimport inline member functions of dllexport/import classes (default) /Zc:sizedDealloc- Disable C++14 sized global deallocation functions diff --git a/include/clang/Driver/CLCompatOptions.td b/include/clang/Driver/CLCompatOptions.td index fb02d856a2..577a66786a 100644 --- a/include/clang/Driver/CLCompatOptions.td +++ b/include/clang/Driver/CLCompatOptions.td @@ -212,6 +212,12 @@ def _SLASH_Zc_alignedNew : CLFlag<"Zc:alignedNew">, def _SLASH_Zc_alignedNew_ : CLFlag<"Zc:alignedNew-">, HelpText<"Disable C++17 aligned allocation functions">, Alias; +def _SLASH_Zc_char8_t : CLFlag<"Zc:char8_t">, + HelpText<"Enable char8_t from C++2a">, + Alias; +def _SLASH_Zc_char8_t_ : CLFlag<"Zc:char8_t-">, + HelpText<"Disable char8_t from c++2a">, + Alias; def _SLASH_Zc_strictStrings : CLFlag<"Zc:strictStrings">, HelpText<"Treat string literals as const">, Alias, AliasArgs<["error=c++11-compat-deprecated-writable-strings"]>; diff --git a/test/Driver/cl-options.c b/test/Driver/cl-options.c index 0f64060d10..4b41720441 100644 --- a/test/Driver/cl-options.c +++ b/test/Driver/cl-options.c @@ -326,6 +326,13 @@ // RUN: %clang_cl -c /Zc:twoPhase -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDOFF %s // DELAYEDOFF-NOT: "-fdelayed-template-parsing" +// RUN: %clang_cl -c -### /std:c++latest -- %s 2>&1 | FileCheck -check-prefix CHECK-LATEST-CHAR8_T %s +// CHECK-LATEST-CHAR8_T-NOT: "-fchar8_t" +// RUN: %clang_cl -c -### /Zc:char8_t -- %s 2>&1 | FileCheck -check-prefix CHECK-CHAR8_T %s +// CHECK-CHAR8_T: "-fchar8_t" +// RUN: %clang_cl -c -### /Zc:char8_t- -- %s 2>&1 | FileCheck -check-prefix CHECK-CHAR8_T_ %s +// CHECK-CHAR8_T_: "-fno-char8_t" + // For some warning ids, we can map from MSVC warning to Clang warning. // RUN: %clang_cl -wd4005 -wd4100 -wd4910 -wd4996 -### -- %s 2>&1 | FileCheck -check-prefix=Wno %s // Wno: "-cc1"