summaryrefslogtreecommitdiffstats
path: root/clang/test/Preprocessor/has_attribute.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2014-11-14 13:44:02 +0000
committerAaron Ballman <aaron@aaronballman.com>2014-11-14 13:44:02 +0000
commita0344c5d7b9b748a2244dce393ceb55e83b495d6 (patch)
tree41c8abfdc700d4744b5da95832035d84aa13ffa7 /clang/test/Preprocessor/has_attribute.cpp
parentc670688addc0a1e8a14b6174ff3626dce82f88ab (diff)
downloadbcm5719-llvm-a0344c5d7b9b748a2244dce393ceb55e83b495d6.tar.gz
bcm5719-llvm-a0344c5d7b9b748a2244dce393ceb55e83b495d6.zip
Complete support for the SD-6 standing document (based off N4200) with support for __has_cpp_attribute.
llvm-svn: 221991
Diffstat (limited to 'clang/test/Preprocessor/has_attribute.cpp')
-rw-r--r--clang/test/Preprocessor/has_attribute.cpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/clang/test/Preprocessor/has_attribute.cpp b/clang/test/Preprocessor/has_attribute.cpp
new file mode 100644
index 00000000000..27c48d077ce
--- /dev/null
+++ b/clang/test/Preprocessor/has_attribute.cpp
@@ -0,0 +1,53 @@
+// RUN: %clang_cc1 -triple i386-unknown-unknown -std=c++11 -E %s -o - | FileCheck %s
+
+// CHECK: has_cxx11_carries_dep
+#if __has_cpp_attribute(carries_dependency)
+ int has_cxx11_carries_dep();
+#endif
+
+// CHECK: has_clang_fallthrough
+#if __has_cpp_attribute(clang::fallthrough)
+ int has_clang_fallthrough();
+#endif
+
+// CHECK: does_not_have_selectany
+#if !__has_cpp_attribute(selectany)
+ int does_not_have_selectany();
+#endif
+
+// 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.
+// CHECK: does_not_have___clang___fallthrough
+#if !__has_cpp_attribute(__clang__::fallthrough)
+ int does_not_have___clang___fallthrough();
+#endif
+
+// Test that C++11, target-specific attributes behave properly.
+
+// CHECK: does_not_have_mips16
+#if !__has_cpp_attribute(gnu::mips16)
+ int does_not_have_mips16();
+#endif
+
+// Test that the version numbers of attributes listed in SD-6 are supported
+// correctly.
+
+// CHECK: has_cxx11_carries_dep_vers
+#if __has_cpp_attribute(carries_dependency) == 200809
+ int has_cxx11_carries_dep_vers();
+#endif
+
+// CHECK: has_cxx11_noreturn_vers
+#if __has_cpp_attribute(noreturn) == 200809
+ int has_cxx11_noreturn_vers();
+#endif
+
+// CHECK: has_cxx14_deprecated_vers
+#if __has_cpp_attribute(deprecated) == 201309
+ int has_cxx14_deprecated_vers();
+#endif
OpenPOWER on IntegriCloud