77 lines · cpp
1// Test without serialization:2// RUN: %clang_cc1 %s -ast-dump | FileCheck %s3//4// Test with serialization:5// RUN: %clang_cc1 -emit-pch -o %t %s6// 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 %s9 10// Verify that the language address space attribute is11// understood correctly by clang.12 13void langas() {14 // CHECK: VarDecl {{.*}} x_global '__global int *'15 __attribute__((opencl_global)) int *x_global;16 17 // CHECK: VarDecl {{.*}} y_global '__global int *'18 int [[clang::opencl_global]] *y_global;19 20 // CHECK: VarDecl {{.*}} z_global '__global int *'21 [[clang::opencl_global]] int *z_global;22 23 // CHECK: VarDecl {{.*}} x_global_device '__global_device int *'24 __attribute__((opencl_global_device)) int *x_global_device;25 26 // CHECK: VarDecl {{.*}} y_global_device '__global_device int *'27 int [[clang::opencl_global_device]] *y_global_device;28 29 // CHECK: VarDecl {{.*}} z_global_device '__global_device int *'30 [[clang::opencl_global_device]] int *z_global_device;31 32 // CHECK: VarDecl {{.*}} x_global_host '__global_host int *'33 __attribute__((opencl_global_host)) int *x_global_host;34 35 // CHECK: VarDecl {{.*}} y_global_host '__global_host int *'36 int [[clang::opencl_global_host]] *y_global_host;37 38 // CHECK: VarDecl {{.*}} z_global_host '__global_host int *'39 [[clang::opencl_global_host]] int *z_global_host;40 41 // CHECK: VarDecl {{.*}} x_local '__local int *'42 __attribute__((opencl_local)) int *x_local;43 44 // CHECK: VarDecl {{.*}} y_local '__local int *'45 int [[clang::opencl_local]] *y_local;46 47 // CHECK: VarDecl {{.*}} z_local '__local int *'48 [[clang::opencl_local]] int *z_local;49 50 // CHECK: VarDecl {{.*}} x_constant '__constant int *'51 __attribute__((opencl_constant)) int *x_constant;52 53 // CHECK: VarDecl {{.*}} y_constant '__constant int *'54 int [[clang::opencl_constant]] *y_constant;55 56 // CHECK: VarDecl {{.*}} z_constant '__constant int *'57 [[clang::opencl_constant]] int *z_constant;58 59 // CHECK: VarDecl {{.*}} x_private '__private int *'60 __attribute__((opencl_private)) int *x_private;61 62 // CHECK: VarDecl {{.*}} y_private '__private int *'63 int [[clang::opencl_private]] *y_private;64 65 // CHECK: VarDecl {{.*}} z_private '__private int *'66 [[clang::opencl_private]] int *z_private;67 68 // CHECK: VarDecl {{.*}} x_generic '__generic int *'69 __attribute__((opencl_generic)) int *x_generic;70 71 // CHECK: VarDecl {{.*}} y_generic '__generic int *'72 int [[clang::opencl_generic]] *y_generic;73 74 // CHECK: VarDecl {{.*}} z_generic '__generic int *'75 [[clang::opencl_generic]] int *z_generic;76}77