summaryrefslogtreecommitdiffstats
path: root/clang/test/Preprocessor/has_attribute.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2018-11-09 17:19:45 +0000
committerAaron Ballman <aaron@aaronballman.com>2018-11-09 17:19:45 +0000
commitc44c174246280dc7614b6591f48010858f482eb9 (patch)
treeee0b46581c0d7149fdf74e5c5943b534b7fec331 /clang/test/Preprocessor/has_attribute.cpp
parent21e7f5e24eb1fef1676d70eb013b1346482a7bac (diff)
downloadbcm5719-llvm-c44c174246280dc7614b6591f48010858f482eb9.tar.gz
bcm5719-llvm-c44c174246280dc7614b6591f48010858f482eb9.zip
Introduce the _Clang scoped attribute token.
Currently, we only accept clang as the scoped attribute identifier for double square bracket attributes provided by Clang, but this has the potential to conflict with user-defined macros. To help alleviate these concerns, this introduces the _Clang scoped attribute identifier as an alias for clang. It also introduces a warning with a fixit on the off chance someone attempts to use __clang__ as the scoped attribute (which is a predefined compiler identification macro). llvm-svn: 346521
Diffstat (limited to 'clang/test/Preprocessor/has_attribute.cpp')
-rw-r--r--clang/test/Preprocessor/has_attribute.cpp38
1 files changed, 27 insertions, 11 deletions
diff --git a/clang/test/Preprocessor/has_attribute.cpp b/clang/test/Preprocessor/has_attribute.cpp
index 53d1fb07b9e..91f3501666f 100644
--- a/clang/test/Preprocessor/has_attribute.cpp
+++ b/clang/test/Preprocessor/has_attribute.cpp
@@ -18,17 +18,33 @@
// The attribute name can be bracketed with double underscores.
// CHECK: has_clang_fallthrough_2
#if __has_cpp_attribute(clang::__fallthrough__)
- int has_clang_fallthrough_2();
-#endif
-
-// The scope cannot be bracketed with double underscores unless it is for gnu.
-// CHECK: does_not_have___clang___fallthrough
-#if !__has_cpp_attribute(__clang__::fallthrough)
- int does_not_have___clang___fallthrough();
-#endif
-// CHECK: has_gnu_const
-#if __has_cpp_attribute(__gnu__::__const__)
- int has_gnu_const();
+ int has_clang_fallthrough_2();
+#endif
+
+// The scope cannot be bracketed with double underscores unless it is
+// for gnu or clang.
+// CHECK: does_not_have___gsl___suppress
+#if !__has_cpp_attribute(__gsl__::suppress)
+ int does_not_have___gsl___suppress();
+#endif
+
+// We do somewhat support the __clang__ vendor namespace, but it is a
+// predefined macro and thus we encourage users to use _Clang instead.
+// Because of this, we do not support __has_cpp_attribute for that
+// vendor namespace.
+// CHECK: does_not_have___clang___fallthrough
+#if !__has_cpp_attribute(__clang__::fallthrough)
+ int does_not_have___clang___fallthrough();
+#endif
+
+// CHECK: does_have_Clang_fallthrough
+#if __has_cpp_attribute(_Clang::fallthrough)
+ int does_have_Clang_fallthrough();
+#endif
+
+// CHECK: has_gnu_const
+#if __has_cpp_attribute(__gnu__::__const__)
+ int has_gnu_const();
#endif
// Test that C++11, target-specific attributes behave properly.
OpenPOWER on IntegriCloud