llvm.org GIT mirror llvm / 50a38dc
Add original source code to test case as suggested in review. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240863 91177308-0d34-0410-b5e6-96231b3b80d8 Adrian Prantl 4 years ago
1 changed file(s) with 58 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
55 ; RUN: %llc_dwarf -O0 -filetype=obj -o %t.o %s
66 ; RUN: llvm-dwarfdump -debug-dump=info %t.o | FileCheck %s
77 ; REQUIRES: object-emission
8
9 ; // ---------------------------------------------------------------------
10 ; // Not packed.
11 ; // ---------------------------------------------------------------------
12 ; struct size8 {
13 ; int i : 4;
14 ; long long l : 60;
15 ; };
16 ; struct layout0 {
17 ; char l0_ofs0;
18 ; struct size8 l0_ofs8;
19 ; int l0_ofs16 : 1;
20 ; } l0;
821
922 %struct.layout0 = type { i8, %struct.size8, i8 }
1023 %struct.size8 = type { i64 }
2235 ; CHECK: DW_AT_bit_size {{.*}} (0x01)
2336 ; CHECK: DW_AT_bit_offset {{.*}} (0x1f)
2437 ; CHECK: DW_AT_data_member_location {{.*}}10
38
39
40 ; // ---------------------------------------------------------------------
41 ; // Implicitly packed.
42 ; // ---------------------------------------------------------------------
43 ; struct size8_anon {
44 ; int : 4;
45 ; long long : 60;
46 ; };
47 ; struct layout1 {
48 ; char l1_ofs0;
49 ; struct size8_anon l1_ofs1;
50 ; int l1_ofs9 : 1;
51 ; } l1;
2552
2653 %struct.layout1 = type <{ i8, %struct.size8_anon, i8, [2 x i8] }>
2754 %struct.size8_anon = type { i64 }
4269 ; CHECK: DW_AT_bit_offset {{.*}} (0x17)
4370 ; CHECK: DW_AT_data_member_location {{.*}}08
4471
72 ; // ---------------------------------------------------------------------
73 ; // Explicitly packed.
74 ; // ---------------------------------------------------------------------
75 ; #pragma pack(1)
76 ; struct size8_pack1 {
77 ; int i : 4;
78 ; long long l : 60;
79 ; };
80 ; struct layout2 {
81 ; char l2_ofs0;
82 ; struct size8_pack1 l2_ofs1;
83 ; int l2_ofs9 : 1;
84 ; } l2;
85 ; #pragma pack()
86
4587 %struct.layout2 = type <{ i8, %struct.size8_pack1, i8 }>
4688 %struct.size8_pack1 = type { i64 }
4789
60102 ; CHECK: DW_AT_bit_size {{.*}} (0x01)
61103 ; CHECK: DW_AT_bit_offset {{.*}} (0x17)
62104 ; CHECK: DW_AT_data_member_location {{.*}}08
105
106 ; // ---------------------------------------------------------------------
107 ; // Explicitly packed with different alignment.
108 ; // ---------------------------------------------------------------------
109 ; #pragma pack(4)
110 ; struct size8_pack4 {
111 ; int i : 4;
112 ; long long l : 60;
113 ; };
114 ; struct layout3 {
115 ; char l3_ofs0;
116 ; struct size8_pack4 l3_ofs4;
117 ; int l3_ofs12 : 1;
118 ; } l 3;
119 ; #pragma pack()
120
63121
64122 %struct.layout3 = type <{ i8, [3 x i8], %struct.size8_pack4, i8, [3 x i8] }>
65123 %struct.size8_pack4 = type { i64 }