1bf379a6571ce8db539cbd22b7b393b4ee859387dJohn McCall// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o %t1 %s 277f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge// RUN: FileCheck --check-prefix=LOCAL %s < %t1 377f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge// RUN: FileCheck --check-prefix=UNDEF %s < %t1 477f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge// RUN: FileCheck --check-prefix=PARAM %s < %t1 577f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge// END. 677f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge 777f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge// LOCAL: private unnamed_addr constant [15 x i8] c"localvar_ann_{{.}}\00", section "llvm.metadata" 877f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge// LOCAL: private unnamed_addr constant [15 x i8] c"localvar_ann_{{.}}\00", section "llvm.metadata" 977f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge 1077f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge// UNDEF: private unnamed_addr constant [15 x i8] c"undefvar_ann_0\00", section "llvm.metadata" 1177f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge 1277f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge// PARAM: private unnamed_addr constant [12 x i8] c"param_ann_{{.}}\00", section "llvm.metadata" 1377f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge// PARAM: private unnamed_addr constant [12 x i8] c"param_ann_{{.}}\00", section "llvm.metadata" 1477f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge// PARAM: private unnamed_addr constant [12 x i8] c"param_ann_{{.}}\00", section "llvm.metadata" 1577f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge// PARAM: private unnamed_addr constant [12 x i8] c"param_ann_{{.}}\00", section "llvm.metadata" 1677f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge 1777f68bb90af93b95045fb994e7cd68137adcc132Julien Lerougeint foo(int v __attribute__((annotate("param_ann_2"))) __attribute__((annotate("param_ann_3")))); 1877f68bb90af93b95045fb994e7cd68137adcc132Julien Lerougeint foo(int v __attribute__((annotate("param_ann_0"))) __attribute__((annotate("param_ann_1")))) { 1977f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge return v + 1; 2077f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge// PARAM: define {{.*}}@foo 21b1f251f30eefdb31eae70057087c22f2fe9f0254John McCall// PARAM: [[V:%.*]] = alloca i32 22b1f251f30eefdb31eae70057087c22f2fe9f0254John McCall// PARAM: bitcast i32* [[V]] to i8* 2377f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge// PARAM-NEXT: call void @llvm.var.annotation( 24b1f251f30eefdb31eae70057087c22f2fe9f0254John McCall// PARAM-NEXT: bitcast i32* [[V]] to i8* 2577f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge// PARAM-NEXT: call void @llvm.var.annotation( 26b1f251f30eefdb31eae70057087c22f2fe9f0254John McCall// PARAM-NEXT: bitcast i32* [[V]] to i8* 2777f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge// PARAM-NEXT: call void @llvm.var.annotation( 28b1f251f30eefdb31eae70057087c22f2fe9f0254John McCall// PARAM-NEXT: bitcast i32* [[V]] to i8* 2977f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge// PARAM-NEXT: call void @llvm.var.annotation( 3077f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge} 3177f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge 32bf379a6571ce8db539cbd22b7b393b4ee859387dJohn McCallvoid local(void) { 3377f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge int localvar __attribute__((annotate("localvar_ann_0"))) __attribute__((annotate("localvar_ann_1"))) = 3; 3493ab6bf534fb6c26563c00f28a8fc5581bb71dfdStephen Lin// LOCAL-LABEL: define void @local() 35bf379a6571ce8db539cbd22b7b393b4ee859387dJohn McCall// LOCAL: [[LOCALVAR:%.*]] = alloca i32, 36bf379a6571ce8db539cbd22b7b393b4ee859387dJohn McCall// LOCAL-NEXT: [[T0:%.*]] = bitcast i32* [[LOCALVAR]] to i8* 373ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar// LOCAL-NEXT: call void @llvm.var.annotation(i8* [[T0]], i8* getelementptr inbounds ([15 x i8], [15 x i8]* @{{.*}}), i8* getelementptr inbounds ({{.*}}), i32 33) 38bf379a6571ce8db539cbd22b7b393b4ee859387dJohn McCall// LOCAL-NEXT: [[T0:%.*]] = bitcast i32* [[LOCALVAR]] to i8* 393ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar// LOCAL-NEXT: call void @llvm.var.annotation(i8* [[T0]], i8* getelementptr inbounds ([15 x i8], [15 x i8]* @{{.*}}), i8* getelementptr inbounds ({{.*}}), i32 33) 40bf379a6571ce8db539cbd22b7b393b4ee859387dJohn McCall} 41bf379a6571ce8db539cbd22b7b393b4ee859387dJohn McCall 42bf379a6571ce8db539cbd22b7b393b4ee859387dJohn McCallvoid undef(void) { 4377f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge int undefvar __attribute__((annotate("undefvar_ann_0"))); 4493ab6bf534fb6c26563c00f28a8fc5581bb71dfdStephen Lin// UNDEF-LABEL: define void @undef() 45bf379a6571ce8db539cbd22b7b393b4ee859387dJohn McCall// UNDEF: [[UNDEFVAR:%.*]] = alloca i32, 46bf379a6571ce8db539cbd22b7b393b4ee859387dJohn McCall// UNDEF-NEXT: [[T0:%.*]] = bitcast i32* [[UNDEFVAR]] to i8* 473ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar// UNDEF-NEXT: call void @llvm.var.annotation(i8* [[T0]], i8* getelementptr inbounds ([15 x i8], [15 x i8]* @{{.*}}), i8* getelementptr inbounds ({{.*}}), i32 43) 4877f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge} 49