[PATCH] D119230: [clang] Add test for C++ DR2390
Timm Bäder via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 10 05:53:29 PST 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rGef2c8274dfa2: [clang] Add test for C++ DR2390 (authored by tbaeder).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119230/new/
https://reviews.llvm.org/D119230
Files:
clang/test/CXX/drs/dr2390.cpp
Index: clang/test/CXX/drs/dr2390.cpp
===================================================================
--- /dev/null
+++ clang/test/CXX/drs/dr2390.cpp
@@ -0,0 +1,47 @@
+// RUN: %clang_cc1 -E -P %s -o - | FileCheck %s
+
+// dr2390: yes
+
+namespace PR48462 {
+// Test that macro expansion of the builtin argument works.
+#define C clang
+#define F fallthrough
+#define CF clang::fallthrough
+
+#if __has_cpp_attribute(F)
+int has_fallthrough;
+#endif
+// CHECK: int has_fallthrough;
+
+#if __has_cpp_attribute(C::F)
+int has_clang_fallthrough_1;
+#endif
+// CHECK: int has_clang_fallthrough_1;
+
+#if __has_cpp_attribute(clang::F)
+int has_clang_fallthrough_2;
+#endif
+// CHECK: int has_clang_fallthrough_2;
+
+#if __has_cpp_attribute(C::fallthrough)
+int has_clang_fallthrough_3;
+#endif
+// CHECK: int has_clang_fallthrough_3;
+
+#if __has_cpp_attribute(CF)
+int has_clang_fallthrough_4;
+#endif
+// CHECK: int has_clang_fallthrough_4;
+
+#define FUNCLIKE1(x) clang::x
+#if __has_cpp_attribute(FUNCLIKE1(fallthrough))
+int funclike_1;
+#endif
+// CHECK: int funclike_1;
+
+#define FUNCLIKE2(x) _Clang::x
+#if __has_cpp_attribute(FUNCLIKE2(fallthrough))
+int funclike_2;
+#endif
+// CHECK: int funclike_2;
+} // namespace PR48462
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119230.407505.patch
Type: text/x-patch
Size: 1233 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220210/df89b0c5/attachment-0001.bin>
More information about the cfe-commits
mailing list