aboutsummaryrefslogtreecommitdiff
path: root/clang/test/AST/pragma-multiple-attributes.cpp
diff options
context:
space:
mode:
authorEgor Zhdan <e_zhdan@apple.com>2022-03-08 22:45:28 +0000
committerEgor Zhdan <e_zhdan@apple.com>2022-03-18 12:20:41 +0000
commit33a9eac6aaa495fce6fd9b17cd48aa57a95461e6 (patch)
treea899b1c33aca914c1391f21a82d2344bd9c66c4e /clang/test/AST/pragma-multiple-attributes.cpp
parent62c481542e63a9019aa469c70cb228fe90ce7ece (diff)
downloadllvm-33a9eac6aaa495fce6fd9b17cd48aa57a95461e6.zip
llvm-33a9eac6aaa495fce6fd9b17cd48aa57a95461e6.tar.gz
llvm-33a9eac6aaa495fce6fd9b17cd48aa57a95461e6.tar.bz2
[Clang] Support multiple attributes in a single pragma
This adds support for multiple attributes in `#pragma clang attribute push`, for example: ``` ``` or ``` ``` Related attributes can now be applied with a single pragma, which makes it harder for developers to make an accidental error later when editing the code. rdar://78269653 Differential Revision: https://reviews.llvm.org/D121283
Diffstat (limited to 'clang/test/AST/pragma-multiple-attributes.cpp')
-rw-r--r--clang/test/AST/pragma-multiple-attributes.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/AST/pragma-multiple-attributes.cpp b/clang/test/AST/pragma-multiple-attributes.cpp
new file mode 100644
index 0000000..b717b3a
--- /dev/null
+++ b/clang/test/AST/pragma-multiple-attributes.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -ast-dump %s | FileCheck %s
+
+#pragma clang attribute push (__attribute__((disable_sanitizer_instrumentation, annotate("test1"))), apply_to=variable(is_global))
+int var1;
+#pragma clang attribute pop
+// CHECK: VarDecl {{.*}} var1
+// CHECK-NEXT: DisableSanitizerInstrumentationAttr {{.*}}
+// CHECK-NEXT: AnnotateAttr {{.*}} "test1"
+
+#pragma clang attribute push ([[clang::disable_sanitizer_instrumentation, clang::annotate("test2")]], apply_to=variable(is_global))
+int var2;
+#pragma clang attribute pop
+// CHECK: VarDecl {{.*}} var2
+// CHECK-NEXT: DisableSanitizerInstrumentationAttr {{.*}}
+// CHECK-NEXT: AnnotateAttr {{.*}} "test2"