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
9 
10 // Veryify the ordering of the address_space attribute still comes before the
11 // type whereas other attributes are still printed after.
12 
13 template <int I>
func()14 void func() {
15   // CHECK: VarDecl {{.*}} x '__attribute__((address_space(1))) int *'
16   __attribute__((address_space(1))) int *x;
17 
18   // CHECK: VarDecl {{.*}} a 'int * __attribute__((noderef))'
19   int __attribute__((noderef)) * a;
20 
21   // CHECK: VarDecl {{.*}} y '__attribute__((address_space(2))) int *'
22   __attribute__((address_space(I))) int *y;
23 
24   // CHECK: VarDecl {{.*}} z '__attribute__((address_space(3))) int *'
25   [[clang::address_space(3)]] int *z;
26 }
27 
func2()28 void func2() {
29   func<2>();
30 }
31