1cddc9993SBruno Ricci // Test without serialization:
211a9bae8SVictor Lomuller // RUN: %clang_cc1 %s -ast-dump | FileCheck %s
3cddc9993SBruno Ricci //
4cddc9993SBruno Ricci // Test with serialization:
5cddc9993SBruno Ricci // RUN: %clang_cc1 -emit-pch -o %t %s
6cddc9993SBruno Ricci // RUN: %clang_cc1 -x c++ -include-pch %t -ast-dump-all /dev/null \
7cddc9993SBruno Ricci // RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
8cddc9993SBruno Ricci // RUN: | FileCheck %s
911a9bae8SVictor Lomuller 
1011a9bae8SVictor Lomuller // Verify that the language address space attribute is
1111a9bae8SVictor Lomuller // understood correctly by clang.
1211a9bae8SVictor Lomuller 
langas()1311a9bae8SVictor Lomuller void langas() {
1411a9bae8SVictor Lomuller   // CHECK: VarDecl {{.*}} x_global '__global int *'
1511a9bae8SVictor Lomuller   __attribute__((opencl_global)) int *x_global;
1611a9bae8SVictor Lomuller 
17*8c7b64b5SMartin Boehme   // CHECK: VarDecl {{.*}} y_global '__global int *'
18*8c7b64b5SMartin Boehme   int [[clang::opencl_global]] *y_global;
19*8c7b64b5SMartin Boehme 
2011a9bae8SVictor Lomuller   // CHECK: VarDecl {{.*}} z_global '__global int *'
2111a9bae8SVictor Lomuller   [[clang::opencl_global]] int *z_global;
2211a9bae8SVictor Lomuller 
238d27be8dSAlexey Bader   // CHECK: VarDecl {{.*}} x_global_device '__global_device int *'
248d27be8dSAlexey Bader   __attribute__((opencl_global_device)) int *x_global_device;
258d27be8dSAlexey Bader 
26*8c7b64b5SMartin Boehme   // CHECK: VarDecl {{.*}} y_global_device '__global_device int *'
27*8c7b64b5SMartin Boehme   int [[clang::opencl_global_device]] *y_global_device;
28*8c7b64b5SMartin Boehme 
298d27be8dSAlexey Bader   // CHECK: VarDecl {{.*}} z_global_device '__global_device int *'
308d27be8dSAlexey Bader   [[clang::opencl_global_device]] int *z_global_device;
318d27be8dSAlexey Bader 
328d27be8dSAlexey Bader   // CHECK: VarDecl {{.*}} x_global_host '__global_host int *'
338d27be8dSAlexey Bader   __attribute__((opencl_global_host)) int *x_global_host;
348d27be8dSAlexey Bader 
35*8c7b64b5SMartin Boehme   // CHECK: VarDecl {{.*}} y_global_host '__global_host int *'
36*8c7b64b5SMartin Boehme   int [[clang::opencl_global_host]] *y_global_host;
37*8c7b64b5SMartin Boehme 
388d27be8dSAlexey Bader   // CHECK: VarDecl {{.*}} z_global_host '__global_host int *'
398d27be8dSAlexey Bader   [[clang::opencl_global_host]] int *z_global_host;
408d27be8dSAlexey Bader 
4111a9bae8SVictor Lomuller   // CHECK: VarDecl {{.*}} x_local '__local int *'
4211a9bae8SVictor Lomuller   __attribute__((opencl_local)) int *x_local;
4311a9bae8SVictor Lomuller 
44*8c7b64b5SMartin Boehme   // CHECK: VarDecl {{.*}} y_local '__local int *'
45*8c7b64b5SMartin Boehme   int [[clang::opencl_local]] *y_local;
46*8c7b64b5SMartin Boehme 
4711a9bae8SVictor Lomuller   // CHECK: VarDecl {{.*}} z_local '__local int *'
4811a9bae8SVictor Lomuller   [[clang::opencl_local]] int *z_local;
4911a9bae8SVictor Lomuller 
5011a9bae8SVictor Lomuller   // CHECK: VarDecl {{.*}} x_constant '__constant int *'
5111a9bae8SVictor Lomuller   __attribute__((opencl_constant)) int *x_constant;
5211a9bae8SVictor Lomuller 
53*8c7b64b5SMartin Boehme   // CHECK: VarDecl {{.*}} y_constant '__constant int *'
54*8c7b64b5SMartin Boehme   int [[clang::opencl_constant]] *y_constant;
55*8c7b64b5SMartin Boehme 
5611a9bae8SVictor Lomuller   // CHECK: VarDecl {{.*}} z_constant '__constant int *'
5711a9bae8SVictor Lomuller   [[clang::opencl_constant]] int *z_constant;
5811a9bae8SVictor Lomuller 
59869d17d8SAnastasia Stulova   // CHECK: VarDecl {{.*}} x_private '__private int *'
6011a9bae8SVictor Lomuller   __attribute__((opencl_private)) int *x_private;
6111a9bae8SVictor Lomuller 
62*8c7b64b5SMartin Boehme   // CHECK: VarDecl {{.*}} y_private '__private int *'
63*8c7b64b5SMartin Boehme   int [[clang::opencl_private]] *y_private;
64*8c7b64b5SMartin Boehme 
65869d17d8SAnastasia Stulova   // CHECK: VarDecl {{.*}} z_private '__private int *'
6611a9bae8SVictor Lomuller   [[clang::opencl_private]] int *z_private;
6711a9bae8SVictor Lomuller 
6811a9bae8SVictor Lomuller   // CHECK: VarDecl {{.*}} x_generic '__generic int *'
6911a9bae8SVictor Lomuller   __attribute__((opencl_generic)) int *x_generic;
7011a9bae8SVictor Lomuller 
71*8c7b64b5SMartin Boehme   // CHECK: VarDecl {{.*}} y_generic '__generic int *'
72*8c7b64b5SMartin Boehme   int [[clang::opencl_generic]] *y_generic;
73*8c7b64b5SMartin Boehme 
7411a9bae8SVictor Lomuller   // CHECK: VarDecl {{.*}} z_generic '__generic int *'
7511a9bae8SVictor Lomuller   [[clang::opencl_generic]] int *z_generic;
7611a9bae8SVictor Lomuller }
77