annotate clang/test/CodeGen/debug-info-packed-struct.c @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -x c -debug-info-kind=limited -emit-llvm -triple x86_64-apple-darwin -o - %s | FileCheck %s
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 // CHECK: %struct.layout3 = type <{ i8, [3 x i8], %struct.size8_pack4, i8, [3 x i8] }>
anatofuz
parents:
diff changeset
4 // CHECK: %struct.layout0 = type { i8, %struct.size8, i8 }
anatofuz
parents:
diff changeset
5 // CHECK: %struct.layout1 = type <{ i8, %struct.size8_anon, i8, [2 x i8] }>
anatofuz
parents:
diff changeset
6 // CHECK: %struct.layout2 = type <{ i8, %struct.size8_pack1, i8 }>
anatofuz
parents:
diff changeset
7
anatofuz
parents:
diff changeset
8 // ---------------------------------------------------------------------
anatofuz
parents:
diff changeset
9 // Not packed.
anatofuz
parents:
diff changeset
10 // ---------------------------------------------------------------------
anatofuz
parents:
diff changeset
11 struct size8 {
anatofuz
parents:
diff changeset
12 int i : 4;
anatofuz
parents:
diff changeset
13 long long l : 60;
anatofuz
parents:
diff changeset
14 };
anatofuz
parents:
diff changeset
15 struct layout0 {
anatofuz
parents:
diff changeset
16 char l0_ofs0;
anatofuz
parents:
diff changeset
17 struct size8 l0_ofs8;
anatofuz
parents:
diff changeset
18 int l0_ofs16 : 1;
anatofuz
parents:
diff changeset
19 };
anatofuz
parents:
diff changeset
20 // CHECK: l0_ofs0
anatofuz
parents:
diff changeset
21 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l0_ofs8",
anatofuz
parents:
diff changeset
22 // CHECK-SAME: {{.*}}size: 64, offset: 64)
anatofuz
parents:
diff changeset
23 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l0_ofs16",
anatofuz
parents:
diff changeset
24 // CHECK-SAME: {{.*}}size: 1, offset: 128, flags: DIFlagBitField, extraData: i64 128)
anatofuz
parents:
diff changeset
25
anatofuz
parents:
diff changeset
26
anatofuz
parents:
diff changeset
27 // ---------------------------------------------------------------------
anatofuz
parents:
diff changeset
28 // Implicitly packed.
anatofuz
parents:
diff changeset
29 // ---------------------------------------------------------------------
anatofuz
parents:
diff changeset
30 struct size8_anon {
anatofuz
parents:
diff changeset
31 int : 4;
anatofuz
parents:
diff changeset
32 long long : 60;
anatofuz
parents:
diff changeset
33 };
anatofuz
parents:
diff changeset
34 struct layout1 {
anatofuz
parents:
diff changeset
35 char l1_ofs0;
anatofuz
parents:
diff changeset
36 struct size8_anon l1_ofs1;
anatofuz
parents:
diff changeset
37 int l1_ofs9 : 1;
anatofuz
parents:
diff changeset
38 };
anatofuz
parents:
diff changeset
39 // CHECK: l1_ofs0
anatofuz
parents:
diff changeset
40 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l1_ofs1",
anatofuz
parents:
diff changeset
41 // CHECK-SAME: {{.*}}size: 64, offset: 8)
anatofuz
parents:
diff changeset
42 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l1_ofs9",
anatofuz
parents:
diff changeset
43 // CHECK-SAME: {{.*}}size: 1, offset: 72, flags: DIFlagBitField, extraData: i64 72)
anatofuz
parents:
diff changeset
44
anatofuz
parents:
diff changeset
45
anatofuz
parents:
diff changeset
46 // ---------------------------------------------------------------------
anatofuz
parents:
diff changeset
47 // Explicitly packed.
anatofuz
parents:
diff changeset
48 // ---------------------------------------------------------------------
anatofuz
parents:
diff changeset
49 #pragma pack(1)
anatofuz
parents:
diff changeset
50 struct size8_pack1 {
anatofuz
parents:
diff changeset
51 int i : 4;
anatofuz
parents:
diff changeset
52 long long l : 60;
anatofuz
parents:
diff changeset
53 };
anatofuz
parents:
diff changeset
54 struct layout2 {
anatofuz
parents:
diff changeset
55 char l2_ofs0;
anatofuz
parents:
diff changeset
56 struct size8_pack1 l2_ofs1;
anatofuz
parents:
diff changeset
57 int l2_ofs9 : 1;
anatofuz
parents:
diff changeset
58 };
anatofuz
parents:
diff changeset
59 #pragma pack()
anatofuz
parents:
diff changeset
60 // CHECK: l2_ofs0
anatofuz
parents:
diff changeset
61 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l2_ofs1",
anatofuz
parents:
diff changeset
62 // CHECK-SAME: {{.*}}size: 64, offset: 8)
anatofuz
parents:
diff changeset
63 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l2_ofs9",
anatofuz
parents:
diff changeset
64 // CHECK-SAME: {{.*}}size: 1, offset: 72, flags: DIFlagBitField, extraData: i64 72)
anatofuz
parents:
diff changeset
65
anatofuz
parents:
diff changeset
66
anatofuz
parents:
diff changeset
67
anatofuz
parents:
diff changeset
68 // ---------------------------------------------------------------------
anatofuz
parents:
diff changeset
69 // Explicitly packed with different alignment.
anatofuz
parents:
diff changeset
70 // ---------------------------------------------------------------------
anatofuz
parents:
diff changeset
71 #pragma pack(4)
anatofuz
parents:
diff changeset
72 struct size8_pack4 {
anatofuz
parents:
diff changeset
73 int i : 4;
anatofuz
parents:
diff changeset
74 long long l : 60;
anatofuz
parents:
diff changeset
75 };
anatofuz
parents:
diff changeset
76 struct layout3 {
anatofuz
parents:
diff changeset
77 char l3_ofs0;
anatofuz
parents:
diff changeset
78 struct size8_pack4 l3_ofs4;
anatofuz
parents:
diff changeset
79 int l3_ofs12 : 1;
anatofuz
parents:
diff changeset
80 };
anatofuz
parents:
diff changeset
81 #pragma pack()
anatofuz
parents:
diff changeset
82 // CHECK: l3_ofs0
anatofuz
parents:
diff changeset
83 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l3_ofs4",
anatofuz
parents:
diff changeset
84 // CHECK-SAME: {{.*}}size: 64, offset: 32)
anatofuz
parents:
diff changeset
85 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l3_ofs12",
anatofuz
parents:
diff changeset
86 // CHECK-SAME: {{.*}}size: 1, offset: 96, flags: DIFlagBitField, extraData: i64 96)
anatofuz
parents:
diff changeset
87
anatofuz
parents:
diff changeset
88 struct layout3 l3;
anatofuz
parents:
diff changeset
89 struct layout0 l0;
anatofuz
parents:
diff changeset
90 struct layout1 l1;
anatofuz
parents:
diff changeset
91 struct layout2 l2;