[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / AST / language_address_space_attribute.cpp
blobfcc293ab5e705cc0c611468c4dd3c3a761e9ae45
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 // Verify that the language address space attribute is
11 // understood correctly by clang.
13 void langas() {
14 // CHECK: VarDecl {{.*}} x_global '__global int *'
15 __attribute__((opencl_global)) int *x_global;
17 // CHECK: VarDecl {{.*}} y_global '__global int *'
18 int [[clang::opencl_global]] *y_global;
20 // CHECK: VarDecl {{.*}} z_global '__global int *'
21 [[clang::opencl_global]] int *z_global;
23 // CHECK: VarDecl {{.*}} x_global_device '__global_device int *'
24 __attribute__((opencl_global_device)) int *x_global_device;
26 // CHECK: VarDecl {{.*}} y_global_device '__global_device int *'
27 int [[clang::opencl_global_device]] *y_global_device;
29 // CHECK: VarDecl {{.*}} z_global_device '__global_device int *'
30 [[clang::opencl_global_device]] int *z_global_device;
32 // CHECK: VarDecl {{.*}} x_global_host '__global_host int *'
33 __attribute__((opencl_global_host)) int *x_global_host;
35 // CHECK: VarDecl {{.*}} y_global_host '__global_host int *'
36 int [[clang::opencl_global_host]] *y_global_host;
38 // CHECK: VarDecl {{.*}} z_global_host '__global_host int *'
39 [[clang::opencl_global_host]] int *z_global_host;
41 // CHECK: VarDecl {{.*}} x_local '__local int *'
42 __attribute__((opencl_local)) int *x_local;
44 // CHECK: VarDecl {{.*}} y_local '__local int *'
45 int [[clang::opencl_local]] *y_local;
47 // CHECK: VarDecl {{.*}} z_local '__local int *'
48 [[clang::opencl_local]] int *z_local;
50 // CHECK: VarDecl {{.*}} x_constant '__constant int *'
51 __attribute__((opencl_constant)) int *x_constant;
53 // CHECK: VarDecl {{.*}} y_constant '__constant int *'
54 int [[clang::opencl_constant]] *y_constant;
56 // CHECK: VarDecl {{.*}} z_constant '__constant int *'
57 [[clang::opencl_constant]] int *z_constant;
59 // CHECK: VarDecl {{.*}} x_private '__private int *'
60 __attribute__((opencl_private)) int *x_private;
62 // CHECK: VarDecl {{.*}} y_private '__private int *'
63 int [[clang::opencl_private]] *y_private;
65 // CHECK: VarDecl {{.*}} z_private '__private int *'
66 [[clang::opencl_private]] int *z_private;
68 // CHECK: VarDecl {{.*}} x_generic '__generic int *'
69 __attribute__((opencl_generic)) int *x_generic;
71 // CHECK: VarDecl {{.*}} y_generic '__generic int *'
72 int [[clang::opencl_generic]] *y_generic;
74 // CHECK: VarDecl {{.*}} z_generic '__generic int *'
75 [[clang::opencl_generic]] int *z_generic;