1 // RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
4 static long long llfoo
;
9 // CHECK: private unnamed_addr constant [13 x i8] {{.*}}annotation_a{{.*}} section "llvm.metadata"
10 // CHECK-NOT: {{.*}}annotation_a{{.*}}
12 static int foo(int a
) {
16 int main(int argc
, char **argv
) {
18 char *b
= (char *) __builtin_annotation((int)barray
, "annotation_a");
19 // CHECK: ptrtoint ptr {{.*}} to i32
20 // CHECK-NEXT: call i32 @llvm.annotation.i32
21 // CHECK: inttoptr {{.*}} to ptr
23 int call
= __builtin_annotation(foo(argc
), "annotation_a");
24 // CHECK: call {{.*}} @foo
25 // CHECK: call i32 @llvm.annotation.i32
27 long long lla
= __builtin_annotation(llfoo
, "annotation_a");
28 // CHECK: call i64 @llvm.annotation.i64
30 int inta
= __builtin_annotation(intfoo
, "annotation_a");
31 // CHECK: load i32, ptr @intfoo
32 // CHECK-NEXT: call i32 @llvm.annotation.i32
35 short shorta
= __builtin_annotation(shortfoo
, "annotation_a");
36 // CHECK: call i16 @llvm.annotation.i16
38 char chara
= __builtin_annotation(charfoo
, "annotation_a");
39 // CHECK: call i8 @llvm.annotation.i8
41 char **arg
= (char**) __builtin_annotation((int) argv
, "annotation_a");
42 // CHECK: ptrtoint ptr {{.*}} to
43 // CHECK: call i32 @llvm.annotation.i32
44 // CHECK: inttoptr {{.*}} to ptr
47 int after_return
= __builtin_annotation(argc
, "annotation_a");
48 // CHECK-NOT: call i32 @llvm.annotation.i32