]> granicus.if.org Git - clang/commitdiff
Driver: support `/Zc:char8_t` and `/Zc:char8_t-`
authorSaleem Abdulrasool <compnerd@compnerd.org>
Tue, 28 May 2019 18:26:00 +0000 (18:26 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Tue, 28 May 2019 18:26:00 +0000 (18:26 +0000)
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

docs/UsersManual.rst
include/clang/Driver/CLCompatOptions.td
test/Driver/cl-options.c

index 88cb72c9b61f1ec7c4f0ea8f099f89b3caff8403..c9195e908276cf6bb0f20bf76ba7868103230549 100644 (file)
@@ -3051,6 +3051,8 @@ Execute ``clang-cl /?`` to see a list of supported options:
       /Yc<filename>           Generate a pch file for all code up to and including <filename>
       /Yu<filename>           Load a pch file and use it instead of all code up to and including <filename>
       /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
index fb02d856a253c868e6faf7eb677f72d7595b8f65..577a66786ad200768724e3dd36fc399e64b62dd8 100644 (file)
@@ -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<fno_aligned_allocation>;
+def _SLASH_Zc_char8_t : CLFlag<"Zc:char8_t">,
+  HelpText<"Enable char8_t from C++2a">,
+  Alias<fchar8__t>;
+def _SLASH_Zc_char8_t_ : CLFlag<"Zc:char8_t-">,
+  HelpText<"Disable char8_t from c++2a">,
+  Alias<fno_char8__t>;
 def _SLASH_Zc_strictStrings : CLFlag<"Zc:strictStrings">,
   HelpText<"Treat string literals as const">, Alias<W_Joined>,
   AliasArgs<["error=c++11-compat-deprecated-writable-strings"]>;
index 0f64060d107e1319ed08ef926239949e4c7bef4b..4b41720441a9d2881e8d61aae2a446d0fa1798d0 100644 (file)
 // 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"