xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/annotations-field.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
2*f4a2713aSLionel Sambuc // END.
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc // CHECK: private unnamed_addr constant [8 x i8] c"v_ann_{{.}}\00", section "llvm.metadata"
5*f4a2713aSLionel Sambuc // CHECK: private unnamed_addr constant [8 x i8] c"v_ann_{{.}}\00", section "llvm.metadata"
6*f4a2713aSLionel Sambuc 
7*f4a2713aSLionel Sambuc struct foo {
8*f4a2713aSLionel Sambuc     int v __attribute__((annotate("v_ann_0"))) __attribute__((annotate("v_ann_1")));
9*f4a2713aSLionel Sambuc };
10*f4a2713aSLionel Sambuc 
11*f4a2713aSLionel Sambuc static struct foo gf;
12*f4a2713aSLionel Sambuc 
main(int argc,char ** argv)13*f4a2713aSLionel Sambuc int main(int argc, char **argv) {
14*f4a2713aSLionel Sambuc     struct foo f;
15*f4a2713aSLionel Sambuc     f.v = argc;
16*f4a2713aSLionel Sambuc // CHECK: getelementptr inbounds %struct.foo* %f, i32 0, i32 0
17*f4a2713aSLionel Sambuc // CHECK-NEXT: bitcast i32* {{.*}} to i8*
18*f4a2713aSLionel Sambuc // CHECK-NEXT: call i8* @llvm.ptr.annotation.p0i8({{.*}}str{{.*}}str{{.*}}i32 8)
19*f4a2713aSLionel Sambuc // CHECK-NEXT: bitcast i8* {{.*}} to i32*
20*f4a2713aSLionel Sambuc // CHECK-NEXT: bitcast i32* {{.*}} to i8*
21*f4a2713aSLionel Sambuc // CHECK-NEXT: call i8* @llvm.ptr.annotation.p0i8({{.*}}str{{.*}}str{{.*}}i32 8)
22*f4a2713aSLionel Sambuc // CHECK-NEXT: bitcast i8* {{.*}} to i32*
23*f4a2713aSLionel Sambuc     gf.v = argc;
24*f4a2713aSLionel Sambuc // CHECK: bitcast i32* getelementptr inbounds (%struct.foo* @gf, i32 0, i32 0) to i8*
25*f4a2713aSLionel Sambuc // CHECK-NEXT: call i8* @llvm.ptr.annotation.p0i8({{.*}}str{{.*}}str{{.*}}i32 8)
26*f4a2713aSLionel Sambuc     return 0;
27*f4a2713aSLionel Sambuc }
28