xref: /llvm-project/clang/test/CodeGen/attr-btf_tag-field.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 __tag1 __tag2;
9 };
10 
foo(struct t1 * arg)11 int foo(struct t1 *arg) {
12   return arg->a;
13 }
14 
15 struct t2 {
16   int b:1 __tag1 __tag2;
17 };
18 
foo2(struct t2 * arg)19 int foo2(struct t2 *arg) {
20   return arg->b;
21 }
22 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "a", scope: ![[#]], file: ![[#]], line: [[#]], baseType: ![[#]], size: 32, annotations: ![[ANNOT:[0-9]+]])
23 // CHECK: ![[ANNOT]] = !{![[TAG1:[0-9]+]], ![[TAG2:[0-9]+]]}
24 // CHECK: ![[TAG1]] = !{!"btf_decl_tag", !"tag1"}
25 // CHECK: ![[TAG2]] = !{!"btf_decl_tag", !"tag2"}
26 
27 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "b", scope: ![[#]], file: ![[#]], line: [[#]], baseType: ![[#]], size: 1, flags: DIFlagBitField, extraData: i64 0, annotations: ![[ANNOT]])
28