Files
clang-p2996/clang/test/AST/pragma-multiple-attributes.cpp
Egor Zhdan 33a9eac6aa [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
2022-03-18 12:20:41 +00:00

16 lines
664 B
C++

// 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"