1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s 2*f4a2713aSLionel Sambuc // END. 3*f4a2713aSLionel Sambuc 4*f4a2713aSLionel Sambuc static long long llfoo; 5*f4a2713aSLionel Sambuc static int intfoo; 6*f4a2713aSLionel Sambuc static short shortfoo; 7*f4a2713aSLionel Sambuc static char charfoo; 8*f4a2713aSLionel Sambuc 9*f4a2713aSLionel Sambuc // CHECK: private unnamed_addr constant [13 x i8] {{.*}}annotation_a{{.*}} section "llvm.metadata" 10*f4a2713aSLionel Sambuc // CHECK-NOT: {{.*}}annotation_a{{.*}} 11*f4a2713aSLionel Sambuc foo(int a)12*f4a2713aSLionel Sambucstatic int foo(int a) { 13*f4a2713aSLionel Sambuc return a + 1; 14*f4a2713aSLionel Sambuc } 15*f4a2713aSLionel Sambuc main(int argc,char ** argv)16*f4a2713aSLionel Sambucint main(int argc, char **argv) { 17*f4a2713aSLionel Sambuc char barray[16]; 18*f4a2713aSLionel Sambuc char *b = (char *) __builtin_annotation((int)barray, "annotation_a"); 19*f4a2713aSLionel Sambuc // CHECK: ptrtoint i8* {{.*}} to i32 20*f4a2713aSLionel Sambuc // CHECK-NEXT: call i32 @llvm.annotation.i32 21*f4a2713aSLionel Sambuc // CHECK: inttoptr {{.*}} to i8* 22*f4a2713aSLionel Sambuc 23*f4a2713aSLionel Sambuc int call = __builtin_annotation(foo(argc), "annotation_a"); 24*f4a2713aSLionel Sambuc // CHECK: call {{.*}} @foo 25*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.annotation.i32 26*f4a2713aSLionel Sambuc 27*f4a2713aSLionel Sambuc long long lla = __builtin_annotation(llfoo, "annotation_a"); 28*f4a2713aSLionel Sambuc // CHECK: call i64 @llvm.annotation.i64 29*f4a2713aSLionel Sambuc 30*f4a2713aSLionel Sambuc int inta = __builtin_annotation(intfoo, "annotation_a"); 31*f4a2713aSLionel Sambuc // CHECK: load i32* @intfoo 32*f4a2713aSLionel Sambuc // CHECK-NEXT: call i32 @llvm.annotation.i32 33*f4a2713aSLionel Sambuc // CHECK-NEXT: store 34*f4a2713aSLionel Sambuc 35*f4a2713aSLionel Sambuc short shorta = __builtin_annotation(shortfoo, "annotation_a"); 36*f4a2713aSLionel Sambuc // CHECK: call i16 @llvm.annotation.i16 37*f4a2713aSLionel Sambuc 38*f4a2713aSLionel Sambuc char chara = __builtin_annotation(charfoo, "annotation_a"); 39*f4a2713aSLionel Sambuc // CHECK: call i8 @llvm.annotation.i8 40*f4a2713aSLionel Sambuc 41*f4a2713aSLionel Sambuc char **arg = (char**) __builtin_annotation((int) argv, "annotation_a"); 42*f4a2713aSLionel Sambuc // CHECK: ptrtoint i8** {{.*}} to 43*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.annotation.i32 44*f4a2713aSLionel Sambuc // CHECK: inttoptr {{.*}} to i8** 45*f4a2713aSLionel Sambuc return 0; 46*f4a2713aSLionel Sambuc } 47