[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGen / annotations-global.c
blob1ae80ef49acd759a8b2a325638a24fff60386abf
1 // RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s --implicit-check-not='section "llvm.metadata"'
2 // RUN: %clang_cc1 %s -triple r600 -emit-llvm -o - | FileCheck %s --check-prefix AS1-GLOBALS
3 // END.
5 static __attribute((annotate("sfoo_0"))) __attribute((annotate("sfoo_1"))) char sfoo;
6 __attribute((annotate("foo_0"))) __attribute((annotate("foo_1"))) char foo;
8 void __attribute((annotate("ann_a_0"))) __attribute((annotate("ann_a_1"))) __attribute((annotate("ann_a_2"))) __attribute((annotate("ann_a_3"))) a(char *a);
9 void __attribute((annotate("ann_a_0"))) __attribute((annotate("ann_a_1"))) a(char *a) {
10 __attribute__((annotate("bar_0"))) __attribute__((annotate("bar_1"))) static char bar;
11 sfoo = 0;
14 __attribute((address_space(1))) __attribute__((annotate("addrspace1_ann"))) char addrspace1_var;
16 // CHECK: target triple
17 // CHECK-DAG: private unnamed_addr constant [7 x i8] c"sfoo_0\00", section "llvm.metadata"
18 // CHECK-DAG: private unnamed_addr constant [7 x i8] c"sfoo_1\00", section "llvm.metadata"
20 // CHECK-DAG: private unnamed_addr constant [6 x i8] c"foo_0\00", section "llvm.metadata"
21 // CHECK-DAG: private unnamed_addr constant [6 x i8] c"foo_1\00", section "llvm.metadata"
23 // CHECK-DAG: private unnamed_addr constant [8 x i8] c"ann_a_0\00", section "llvm.metadata"
24 // CHECK-DAG: private unnamed_addr constant [8 x i8] c"ann_a_1\00", section "llvm.metadata"
25 // CHECK-DAG: private unnamed_addr constant [8 x i8] c"ann_a_2\00", section "llvm.metadata"
26 // CHECK-DAG: private unnamed_addr constant [8 x i8] c"ann_a_3\00", section "llvm.metadata"
28 // CHECK-DAG: private unnamed_addr constant [6 x i8] c"bar_0\00", section "llvm.metadata"
29 // CHECK-DAG: private unnamed_addr constant [6 x i8] c"bar_1\00", section "llvm.metadata"
31 // CHECK-DAG: private unnamed_addr constant [15 x i8] c"addrspace1_ann\00", section "llvm.metadata"
33 // CHECK: @llvm.global.annotations = appending global [11 x { ptr, ptr, ptr, i32, ptr }] [{
34 // CHECK-SAME: { ptr @a.bar,
35 // CHECK-SAME: { ptr @a.bar,
36 // CHECK-SAME: { ptr @sfoo,
37 // CHECK-SAME: { ptr @sfoo,
38 // CHECK-SAME: { ptr @foo,
39 // CHECK-SAME: { ptr @foo,
40 // CHECK-SAME: { ptr addrspacecast (ptr addrspace(1) @addrspace1_var to ptr),
41 // CHECK-SAME: { ptr @a,
42 // CHECK-SAME: { ptr @a,
43 // CHECK-SAME: { ptr @a,
44 // CHECK-SAME: { ptr @a,
45 // CHECK-SAME: }], section "llvm.metadata"
47 // AS1-GLOBALS: target datalayout = "{{.+}}-A5-G1"
48 // AS1-GLOBALS: @llvm.global.annotations = appending addrspace(1) global [11 x { ptr addrspace(1), ptr addrspace(4), ptr addrspace(4), i32, ptr addrspace(4) }]
49 // AS1-GLOBALS-SAME: { ptr addrspace(1) @a.bar,
50 // AS1-GLOBALS-SAME: { ptr addrspace(1) @addrspace1_var,