diff options
| author | Reid Kleckner <rnk@google.com> | 2019-03-25 23:20:18 +0000 |
|---|---|---|
| committer | Reid Kleckner <rnk@google.com> | 2019-03-25 23:20:18 +0000 |
| commit | 1181c9f45db11e2c58170bd7e7b0bd49f1dcd63b (patch) | |
| tree | d477de943d426528e244d53fd14e04b13a005b10 /clang/test | |
| parent | 1e5d569c8c789b3d995bcecc354c44cea60902e8 (diff) | |
| download | bcm5719-llvm-1181c9f45db11e2c58170bd7e7b0bd49f1dcd63b.tar.gz bcm5719-llvm-1181c9f45db11e2c58170bd7e7b0bd49f1dcd63b.zip | |
[MS] Add frontend support for __declspec(allocator)
The intention is to add metadata to direct call sites of functions
marked with __declspec(allocator), which will ultimately result in some
S_HEAPALLOCSITE debug info records when emitting codeview.
This is a piece of PR38491
llvm-svn: 356964
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/SemaCXX/declspec-allocator.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/declspec-allocator.cpp b/clang/test/SemaCXX/declspec-allocator.cpp new file mode 100644 index 00000000000..e1af497ba12 --- /dev/null +++ b/clang/test/SemaCXX/declspec-allocator.cpp @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -fms-compatibility -triple x86_64-windows-msvc -std=c++14 -fms-extensions -fms-compatibility-version=19.00 -verify %s + +__declspec(allocator) int err_on_data; // expected-warning {{'allocator' attribute only applies to functions}} +__declspec(allocator) struct ErrOnStruct1; // expected-warning {{place it after "struct" to apply attribute}} +struct __declspec(allocator) ErrOnStruct2 {}; // expected-warning {{'allocator' attribute only applies to functions}} +__declspec(allocator) void err_on_ret_void(); // expected-warning {{not a pointer or reference type}} +__declspec(allocator) int err_on_ret_int(); // expected-warning {{not a pointer or reference type}} +__declspec(allocator) void *accept_on_ptr1(); +__declspec(allocator) void *accept_on_ptr2(size_t); +void * __declspec(allocator) accept_on_ptr3(size_t); // expected-error {{expected unqualified-id}} + +struct Foo { int x; }; +__declspec(allocator) Foo *accept_nonvoid_ptr(size_t); |

