1 ; RUN: llc -dwarf-version=2 -mtriple x86_64-apple-macosx -O0 -filetype=obj -o %t_2_le.o %s
2 ; RUN: llvm-dwarfdump -v -debug-info %t_2_le.o | FileCheck %s
4 ; Produced at -O0 from:
8 ; } __attribute__((__packed__)) b;
10 ; Note that DWARF 2 counts bit offsets backwards from the high end of
11 ; the storage unit to the high end of the bit field.
13 ; CHECK: DW_TAG_member
14 ; CHECK-NEXT: DW_AT_name{{.*}}"a"
15 ; CHECK-NOT: DW_TAG_member
16 ; CHECK: DW_AT_byte_size {{.*}} (0x01)
17 ; CHECK-NEXT: DW_AT_bit_size {{.*}} (0x06)
18 ; CHECK-NEXT: DW_AT_bit_offset {{.*}} (-1)
19 ; CHECK-NEXT: DW_AT_data_member_location {{.*}} ({{.*}}0x0{{0*}})
21 ; ModuleID = 'repro.c'
22 source_filename = "repro.c"
23 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
24 target triple = "x86_64-apple-macosx10.4.0"
26 %struct.anon = type { i16 }
28 @b = global %struct.anon zeroinitializer, align 1, !dbg !0
31 !llvm.module.flags = !{!10, !11, !12, !13}
34 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
35 !1 = distinct !DIGlobalVariable(name: "b", scope: !2, file: !3, line: 4, type: !6, isLocal: false, isDefinition: true)
36 !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 11.0.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, nameTableKind: None, sysroot: "/")
37 !3 = !DIFile(filename: "repro.c", directory: "/tmp")
40 !6 = distinct !DICompositeType(tag: DW_TAG_structure_type, file: !3, line: 1, size: 16, elements: !7)
42 !8 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !6, file: !3, line: 3, baseType: !9, size: 6, offset: 3, flags: DIFlagBitField, extraData: i64 0)
43 !9 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
44 !10 = !{i32 7, !"Dwarf Version", i32 2}
45 !11 = !{i32 2, !"Debug Info Version", i32 3}
46 !12 = !{i32 1, !"wchar_size", i32 4}
47 !13 = !{i32 7, !"PIC Level", i32 2}
48 !14 = !{!"clang version 11.0.0 "}