Clang Project

clang_source_code/test/AST/address_space_attribute.cpp
1// RUN: %clang_cc1 %s -ast-dump | FileCheck %s
2
3// Veryify the ordering of the address_space attribute still comes before the
4// type whereas other attributes are still printed after.
5
6template <int I>
7void func() {
8  // CHECK: VarDecl {{.*}} x '__attribute__((address_space(1))) int *'
9  __attribute__((address_space(1))) int *x;
10
11  // CHECK: VarDecl {{.*}} a 'int * __attribute__((noderef))'
12  int __attribute__((noderef)) * a;
13
14  // CHECK: VarDecl {{.*}} y '__attribute__((address_space(2))) int *'
15  __attribute__((address_space(I))) int *y;
16
17  // CHECK: VarDecl {{.*}} z '__attribute__((address_space(3))) int *'
18  [[clang::address_space(3)]] int *z;
19}
20
21void func2() {
22  func<2>();
23}
24