llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Vlad Serebrennikov (Endilll) <details> <summary>Changes</summary> This patch refactors an existing test for [CWG2390](https://cplusplus.github.io/CWG/issues/2390.html) "Is the argument of `__has_cpp_attribute` macro-expanded?" to use `#error` instead of emitting a variable in IRGen and checking it via FileCheck. As a bonus, this makes it possible to move the test into `cwg23xx.cpp`. --- Full diff: https://github.com/llvm/llvm-project/pull/94206.diff 2 Files Affected: - (removed) clang/test/CXX/drs/cwg2390.cpp (-47) - (modified) clang/test/CXX/drs/cwg23xx.cpp (+36-1) ``````````diff diff --git a/clang/test/CXX/drs/cwg2390.cpp b/clang/test/CXX/drs/cwg2390.cpp deleted file mode 100644 index 41bbd0d1c5499..0000000000000 --- a/clang/test/CXX/drs/cwg2390.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// RUN: %clang_cc1 -E -P %s -o - | FileCheck %s - -// cwg2390: 14 - -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 diff --git a/clang/test/CXX/drs/cwg23xx.cpp b/clang/test/CXX/drs/cwg23xx.cpp index ae5ec3b878f59..e4a1e90941dbf 100644 --- a/clang/test/CXX/drs/cwg23xx.cpp +++ b/clang/test/CXX/drs/cwg23xx.cpp @@ -317,7 +317,42 @@ namespace cwg2387 { // cwg2387: 9 #endif } -// cwg2390 is in cwg2390.cpp +namespace cwg2390 { // cwg2390: 14 +// Test that macro expansion of the builtin argument works. +#define C clang +#define F fallthrough +#define CF clang::fallthrough + +#if !__has_cpp_attribute(F) +#error "doesn't have fallthrough" +#endif + +#if !__has_cpp_attribute(C::F) +#error "doesn't have clang::fallthrough 1" +#endif + +#if !__has_cpp_attribute(clang::F) +#error "doesn't have clang::fallthrough 2" +#endif + +#if !__has_cpp_attribute(C::fallthrough) +#error "doesn't have clang::fallthrough 3" +#endif + +#if !__has_cpp_attribute(CF) +#error "doesn't have clang::fallthrough 4" +#endif + +#define FUNCLIKE1(x) clang::x +#if !__has_cpp_attribute(FUNCLIKE1(fallthrough)) +#error "doesn't have clang::fallthrough through func-like macro 1" +#endif + +#define FUNCLIKE2(x) _Clang::x +#if !__has_cpp_attribute(FUNCLIKE2(fallthrough)) +#error "doesn't have clang::fallthrough through func-like macro 2" +#endif +} // namespace cwg2390 namespace cwg2394 { // cwg2394: 15 `````````` </details> https://github.com/llvm/llvm-project/pull/94206 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits