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 // Verify that the language address space attribute is
11 // understood correctly by clang.
12 
langas()13 void langas() {
14   // CHECK: VarDecl {{.*}} x_global '__global int *'
15   __attribute__((opencl_global)) int *x_global;
16 
17   // CHECK: VarDecl {{.*}} z_global '__global int *'
18   [[clang::opencl_global]] int *z_global;
19 
20   // CHECK: VarDecl {{.*}} x_local '__local int *'
21   __attribute__((opencl_local)) int *x_local;
22 
23   // CHECK: VarDecl {{.*}} z_local '__local int *'
24   [[clang::opencl_local]] int *z_local;
25 
26   // CHECK: VarDecl {{.*}} x_constant '__constant int *'
27   __attribute__((opencl_constant)) int *x_constant;
28 
29   // CHECK: VarDecl {{.*}} z_constant '__constant int *'
30   [[clang::opencl_constant]] int *z_constant;
31 
32   // CHECK: VarDecl {{.*}} x_private '__private int *'
33   __attribute__((opencl_private)) int *x_private;
34 
35   // CHECK: VarDecl {{.*}} z_private '__private int *'
36   [[clang::opencl_private]] int *z_private;
37 
38   // CHECK: VarDecl {{.*}} x_generic '__generic int *'
39   __attribute__((opencl_generic)) int *x_generic;
40 
41   // CHECK: VarDecl {{.*}} z_generic '__generic int *'
42   [[clang::opencl_generic]] int *z_generic;
43 }
44