1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o %t1 %s 2 // RUN: FileCheck --check-prefix=LOCAL %s < %t1 3 // RUN: FileCheck --check-prefix=UNDEF %s < %t1 4 // RUN: FileCheck --check-prefix=PARAM %s < %t1 5 // END. 6 7 // LOCAL: private unnamed_addr constant [15 x i8] c"localvar_ann_{{.}}\00", section "llvm.metadata" 8 // LOCAL: private unnamed_addr constant [15 x i8] c"localvar_ann_{{.}}\00", section "llvm.metadata" 9 10 // UNDEF: private unnamed_addr constant [15 x i8] c"undefvar_ann_0\00", section "llvm.metadata" 11 12 // PARAM: private unnamed_addr constant [12 x i8] c"param_ann_{{.}}\00", section "llvm.metadata" 13 // PARAM: private unnamed_addr constant [12 x i8] c"param_ann_{{.}}\00", section "llvm.metadata" 14 // PARAM: private unnamed_addr constant [12 x i8] c"param_ann_{{.}}\00", section "llvm.metadata" 15 // PARAM: private unnamed_addr constant [12 x i8] c"param_ann_{{.}}\00", section "llvm.metadata" 16 17 int foo(int v __attribute__((annotate("param_ann_2"))) __attribute__((annotate("param_ann_3")))); 18 int foo(int v __attribute__((annotate("param_ann_0"))) __attribute__((annotate("param_ann_1")))) { 19 return v + 1; 20 // PARAM: define {{.*}}@foo 21 // PARAM: [[V:%.*]] = alloca i32 22 // PARAM: bitcast i32* [[V]] to i8* 23 // PARAM-NEXT: call void @llvm.var.annotation( 24 // PARAM-NEXT: bitcast i32* [[V]] to i8* 25 // PARAM-NEXT: call void @llvm.var.annotation( 26 // PARAM-NEXT: bitcast i32* [[V]] to i8* 27 // PARAM-NEXT: call void @llvm.var.annotation( 28 // PARAM-NEXT: bitcast i32* [[V]] to i8* 29 // PARAM-NEXT: call void @llvm.var.annotation( 30 } 31 32 void local(void) { 33 int localvar __attribute__((annotate("localvar_ann_0"))) __attribute__((annotate("localvar_ann_1"))) = 3; 34 // LOCAL-LABEL: define void @local() 35 // LOCAL: [[LOCALVAR:%.*]] = alloca i32, 36 // LOCAL-NEXT: [[T0:%.*]] = bitcast i32* [[LOCALVAR]] to i8* 37 // LOCAL-NEXT: call void @llvm.var.annotation(i8* [[T0]], i8* getelementptr inbounds ([15 x i8], [15 x i8]* @{{.*}}), i8* getelementptr inbounds ({{.*}}), i32 33) 38 // LOCAL-NEXT: [[T0:%.*]] = bitcast i32* [[LOCALVAR]] to i8* 39 // LOCAL-NEXT: call void @llvm.var.annotation(i8* [[T0]], i8* getelementptr inbounds ([15 x i8], [15 x i8]* @{{.*}}), i8* getelementptr inbounds ({{.*}}), i32 33) 40 } 41 42 void undef(void) { 43 int undefvar __attribute__((annotate("undefvar_ann_0"))); 44 // UNDEF-LABEL: define void @undef() 45 // UNDEF: [[UNDEFVAR:%.*]] = alloca i32, 46 // UNDEF-NEXT: [[T0:%.*]] = bitcast i32* [[UNDEFVAR]] to i8* 47 // UNDEF-NEXT: call void @llvm.var.annotation(i8* [[T0]], i8* getelementptr inbounds ([15 x i8], [15 x i8]* @{{.*}}), i8* getelementptr inbounds ({{.*}}), i32 43) 48 } 49