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
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"
10 // UNDEF: private unnamed_addr constant [15 x i8] c"undefvar_ann_0\00", section "llvm.metadata"
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"
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")))) {
20 // PARAM: define {{.*}}@foo
21 // PARAM: [[V:%.*]] = alloca i32
22 // PARAM: call void @llvm.var.annotation.p0.p0(
23 // PARAM-NEXT: call void @llvm.var.annotation.p0.p0(
24 // PARAM-NEXT: call void @llvm.var.annotation.p0.p0(
25 // PARAM-NEXT: call void @llvm.var.annotation.p0.p0(
29 int localvar
__attribute__((annotate("localvar_ann_0"))) __attribute__((annotate("localvar_ann_1"))) = 3;
30 // LOCAL-LABEL: define{{.*}} void @local()
31 // LOCAL: [[LOCALVAR:%.*]] = alloca i32,
32 // LOCAL-NEXT: call void @llvm.var.annotation.p0.p0(ptr [[LOCALVAR]], ptr @{{.*}}, ptr @{{.*}}, i32 29, ptr null)
33 // LOCAL-NEXT: call void @llvm.var.annotation.p0.p0(ptr [[LOCALVAR]], ptr @{{.*}}, ptr @{{.*}}, i32 29, ptr null)
36 void local_after_return(void) {
38 int localvar
__attribute__((annotate("localvar_after_return"))) = 3;
39 // Test we are not emitting instructions like bitcast or call outside of a basic block.
40 // LOCAL-LABEL: define{{.*}} void @local_after_return()
41 // LOCAL: [[LOCALVAR:%.*]] = alloca i32,
42 // LOCAL-NEXT: ret void
46 int undefvar
__attribute__((annotate("undefvar_ann_0")));
47 // UNDEF-LABEL: define{{.*}} void @undef()
48 // UNDEF: [[UNDEFVAR:%.*]] = alloca i32,
49 // UNDEF-NEXT: call void @llvm.var.annotation.p0.p0(ptr [[UNDEFVAR]], ptr @{{.*}}, ptr @{{.*}}, i32 46, ptr null)