]> granicus.if.org Git - clang/commitdiff
Add a subgroup of c++1z-compat to enable and disable the warning about
authorAkira Hatanaka <ahatanaka@apple.com>
Tue, 20 Jun 2017 06:18:46 +0000 (06:18 +0000)
committerAkira Hatanaka <ahatanaka@apple.com>
Tue, 20 Jun 2017 06:18:46 +0000 (06:18 +0000)
c++17's non-throwing exception specification in function signature.

rdar://problem/32628743

Differential Revision: https://reviews.llvm.org/D34251

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305772 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticGroups.td
include/clang/Basic/DiagnosticSemaKinds.td
test/SemaCXX/cxx1z-noexcept-function-type.cpp

index cf404768472f24977de293d2757190c4b6bdae57..36b64a12522830943ef40dba782f5911952b4729 100644 (file)
@@ -149,6 +149,7 @@ def GNUFlexibleArrayUnionMember : DiagGroup<"gnu-flexible-array-union-member">;
 def GNUFoldingConstant : DiagGroup<"gnu-folding-constant">;
 def FormatExtraArgs : DiagGroup<"format-extra-args">;
 def FormatZeroLength : DiagGroup<"format-zero-length">;
+def CXX1zCompatMangling : DiagGroup<"c++1z-compat-mangling">;
 
 // Warnings for C++1y code which is not compatible with prior C++ standards.
 def CXXPre14Compat : DiagGroup<"c++98-c++11-compat">;
@@ -211,7 +212,8 @@ def CXX14CompatPedantic : DiagGroup<"c++14-compat-pedantic",
                                     [CXXPre1zCompatPedantic]>;
 
 def CXX1zCompat : DiagGroup<"c++1z-compat", [DeprecatedRegister,
-                                             DeprecatedIncrementBool]>;
+                                             DeprecatedIncrementBool,
+                                             CXX1zCompatMangling]>;
 
 def ExitTimeDestructors : DiagGroup<"exit-time-destructors">;
 def FlexibleArrayExtensions : DiagGroup<"flexible-array-extensions">;
index aa73a6934518781ed31c5a62b1995e784cf539c9..36b41c35b93dcd3ccddc6c5ce5acb003a90dda93 100644 (file)
@@ -507,7 +507,7 @@ def warn_deprecated_copy_operation : Warning<
   InGroup<Deprecated>, DefaultIgnore;
 def warn_cxx1z_compat_exception_spec_in_signature : Warning<
   "mangled name of %0 will change in C++17 due to non-throwing exception "
-  "specification in function signature">, InGroup<CXX1zCompat>;
+  "specification in function signature">, InGroup<CXX1zCompatMangling>;
 
 def warn_global_constructor : Warning<
   "declaration requires a global constructor">,
index 40dc3a22e530b40a9f892fe3f46795c07bcca4a5..524ea8e53c10bd5ad7d495c2bce5b4c4b1be71ff 100644 (file)
@@ -1,5 +1,6 @@
 // RUN: %clang_cc1 -std=c++14 -verify -fexceptions -fcxx-exceptions %s
 // RUN: %clang_cc1 -std=c++1z -verify -fexceptions -fcxx-exceptions %s -Wno-dynamic-exception-spec
+// RUN: %clang_cc1 -std=c++14 -verify -fexceptions -fcxx-exceptions -Wno-c++1z-compat-mangling -DNO_COMPAT_MANGLING %s
 
 #if __cplusplus > 201402L
 
@@ -81,7 +82,7 @@ namespace CompatWarning {
   auto f5() -> void (*)() throw();
   auto f6() -> void (&)() throw();
   auto f7() -> void (X::*)() throw();
-#if __cplusplus <= 201402L
+#if __cplusplus <= 201402L && !defined(NO_COMPAT_MANGLING)
   // expected-warning@-8 {{mangled name of 'f1' will change in C++17 due to non-throwing exception specification in function signature}}
   // expected-warning@-8 {{mangled name of 'f2' will change in C++17 due to non-throwing exception specification in function signature}}
   // expected-warning@-8 {{mangled name of 'f3' will change in C++17 due to non-throwing exception specification in function signature}}