xref: /llvm-project/clang/test/CodeGen/attr-btf_tag-diglobalvariable.c (revision a162b67c98066218d0d00aa13b99afb95d9bb5e6)
1 // REQUIRES: x86-registered-target
2 // RUN: %clang -target x86_64 -g -S -emit-llvm -o - %s | FileCheck %s
3 
4 #define __tag1 __attribute__((btf_decl_tag("tag1")))
5 #define __tag2 __attribute__((btf_decl_tag("tag2")))
6 
7 struct t1 {
8   int a;
9 };
10 struct t1 g1 __tag1 __tag2;
11 
12 extern struct t1 g2 __tag1 __tag2;
13 struct t1 g2;
14 
15 // CHECK: distinct !DIGlobalVariable(name: "g1", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[#]], isLocal: false, isDefinition: true, annotations: ![[ANNOT:[0-9]+]])
16 // CHECK: distinct !DIGlobalVariable(name: "g2", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[#]], isLocal: false, isDefinition: true, annotations: ![[ANNOT]])
17 // CHECK: ![[ANNOT]] = !{![[TAG1:[0-9]+]], ![[TAG2:[0-9]+]]}
18 // CHECK: ![[TAG1]] = !{!"btf_decl_tag", !"tag1"}
19 // CHECK: ![[TAG2]] = !{!"btf_decl_tag", !"tag2"}
20 
21 extern struct t1 g3 __tag1;
22 struct t1 g3 __tag2;
23 
24 // CHECK: distinct !DIGlobalVariable(name: "g3", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[#]], isLocal: false, isDefinition: true, annotations: ![[ANNOT]])
25 
26 extern struct t1 g4;
27 struct t1 g4 __tag1 __tag2;
28 
29 // CHECK: distinct !DIGlobalVariable(name: "g4", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[#]], isLocal: false, isDefinition: true, annotations: ![[ANNOT]])
30