[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / AST / address_space_attribute.cpp
blob50777ddc750604b49eac06df9a79bab2fdd73fa0
1 // Test without serialization:
2 // RUN: %clang_cc1 %s -ast-dump | FileCheck %s
3 //
4 // Test with serialization:
5 // RUN: %clang_cc1 -emit-pch -o %t %s
6 // RUN: %clang_cc1 -x c++ -include-pch %t -ast-dump-all /dev/null \
7 // RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
8 // RUN: | FileCheck %s
10 // Veryify the ordering of the address_space attribute still comes before the
11 // type whereas other attributes are still printed after.
13 template <int I>
14 void func() {
15 // CHECK: VarDecl {{.*}} x '__attribute__((address_space(1))) int *'
16 __attribute__((address_space(1))) int *x;
18 // CHECK: VarDecl {{.*}} a 'int * __attribute__((noderef))'
19 int __attribute__((noderef)) * a;
21 // CHECK: VarDecl {{.*}} y '__attribute__((address_space(2))) int *'
22 __attribute__((address_space(I))) int *y;
24 // CHECK: VarDecl {{.*}} z '__attribute__((address_space(3))) int *'
25 [[clang::address_space(3)]] int *z;
28 void func2() {
29 func<2>();