xref: /llvm-project/clang/test/CodeGen/attr-btf_tag-dicomposite.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 __tag1 __tag2 t1;
8 struct t1 {
9   int a;
10 };
11 
foo(struct t1 * arg)12 int foo(struct t1 *arg) {
13   return arg->a;
14 }
15 
16 // CHECK: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "t1", file: ![[#]], line: [[#]], size: 32, elements: ![[#]], annotations: ![[ANNOT:[0-9]+]])
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 struct __tag1 t2;
22 struct __tag2 t2 {
23   int a;
24 };
25 
foo2(struct t2 * arg)26 int foo2(struct t2 *arg) {
27   return arg->a;
28 }
29 
30 // CHECK: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "t2", file: ![[#]], line: [[#]], size: 32, elements: ![[#]], annotations: ![[ANNOT]])
31 
32 struct __tag1 t3;
33 struct t3 {
34   int a;
35 } __tag2;
36 
foo3(struct t3 * arg)37 int foo3(struct t3 *arg) {
38   return arg->a;
39 }
40 
41 // CHECK: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "t3", file: ![[#]], line: [[#]], size: 32, elements: ![[#]], annotations: ![[ANNOT]])
42 
43 struct t4;
44 struct t4 {
45   int a;
46 } __tag1 __tag2;
47 
foo4(struct t4 * arg)48 int foo4(struct t4 *arg) {
49   return arg->a;
50 }
51 
52 // CHECK: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "t4", file: ![[#]], line: [[#]], size: 32, elements: ![[#]], annotations: ![[ANNOT]])
53