llvm-project/clang/test/Parser/pragma-attribute-declspec.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

15 lines
592 B
C++

// RUN: %clang_cc1 -triple i386-pc-win32 -std=c++11 -verify -Wno-pragma-clang-attribute -fms-extensions -fms-compatibility %s
#pragma clang attribute push(__declspec(dllexport), apply_to = function)
void function();
#pragma clang attribute pop
#pragma clang attribute push(__declspec(dllexport, dllimport), apply_to = function)
#pragma clang attribute pop
#pragma clang attribute push(__declspec(align), apply_to = variable) // expected-error {{attribute 'align' is not supported by '#pragma clang attribute'}}
#pragma clang attribute push(__declspec(), apply_to = variable) // A noop