[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGenSYCL / field-annotate-addr-space.cpp
bloba7a3089f7d26723008ac1d4df37322bfbdd3b1dd
1 // RUN: %clang_cc1 -no-opaque-pointers -triple spir64 -fsycl-is-device -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s
3 // CHECK: [[ANNOT:.+]] = private unnamed_addr addrspace(1) constant {{.*}}c"my_annotation\00"
5 struct HasField {
6 // This caused an assertion on creating a bitcast here,
7 // since the address space didn't match.
8 [[clang::annotate("my_annotation")]]
9 int *a;
12 void foo(int *b) {
13 struct HasField f;
14 // CHECK: %[[A:.+]] = getelementptr inbounds %struct.HasField, %struct.HasField addrspace(4)* %{{.+}}
15 // CHECK: %[[BITCAST:.+]] = bitcast i32 addrspace(4)* addrspace(4)* %[[A]] to i8 addrspace(4)*
16 // CHECK: %[[CALL:.+]] = call i8 addrspace(4)* @llvm.ptr.annotation.p4i8.p1i8(i8 addrspace(4)* %[[BITCAST]], i8 addrspace(1)* getelementptr inbounds ([14 x i8], [14 x i8] addrspace(1)* [[ANNOT]]
17 // CHECK: bitcast i8 addrspace(4)* %[[CALL]] to i32 addrspace(4)* addrspace(4)*
18 f.a = b;