2016-04-28 23:37:48 +08:00
; RUN: llc -mtriple x86_64-apple-macosx -O0 -filetype=obj -o - %s \
2017-09-12 07:05:20 +08:00
; RUN: | llvm-dwarfdump -v -debug-info - | FileCheck %s
2016-05-18 04:12:08 +08:00
; RUN: llc -mtriple x86_64-gnu-linux -O0 -filetype=obj -o - %s \
2017-09-12 07:05:20 +08:00
; RUN: | llvm-dwarfdump -v -debug-info - | FileCheck %s --check-prefix=LINUX
2016-05-18 04:12:08 +08:00
; LINUX-NOT: DW_AT_data_bit_offset
2016-04-28 23:37:48 +08:00
;
; Generated from:
; #include <stdint.h>
; #pragma pack(1)
; struct PackedBits
; {
; char a;
; uint32_t b : 5,
; c : 27
; } s;
; #pragma pack()
source_filename = "bitfield.c"
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx"
%struct.PackedBits = type < { i8 , i32 } >
2016-12-22 08:45:21 +08:00
@s = common global %struct.PackedBits zeroinitializer , align 1 , !dbg !0
2016-04-28 23:37:48 +08:00
2016-12-22 08:45:21 +08:00
!llvm.dbg.cu = ! { !2 }
!llvm.module.flags = ! { !15 , !16 , !17 }
!llvm.ident = ! { !18 }
2016-04-28 23:37:48 +08:00
2017-08-31 02:06:51 +08:00
!0 = distinct !DIGlobalVariableExpression ( var: !1 , expr: !DIExpression ( ) )
2016-12-22 08:45:21 +08:00
!1 = !DIGlobalVariable ( name: "s" , scope: !2 , file: !3 , line: 8 , type: !6 , isLocal: false , isDefinition: true )
!2 = distinct !DICompileUnit ( language: D W _ L A N G _ C 99 , file: !3 , producer: "clang version 3.9.0 (trunk 267633)" , isOptimized: false , runtimeVersion: 0 , emissionKind: F u l l D e b u g , enums: !4 , globals: !5 )
!3 = !DIFile ( filename: "bitfield.c" , directory: "/Volumes/Data/llvm" )
!4 = ! { }
!5 = ! { !0 }
!6 = distinct !DICompositeType ( tag: D W _ T A G _ s t r u c t u r e _ type , name: "PackedBits" , file: !3 , line: 3 , size: 40 , elements: !7 )
!7 = ! { !8 , !10 , !14 }
!8 = !DIDerivedType ( tag: D W _ T A G _ m e m b e r , name: "a" , scope: !6 , file: !3 , line: 5 , baseType: !9 , size: 8 )
2016-04-28 23:37:48 +08:00
; CHECK: DW_TAG_member
; CHECK-NEXT: DW_AT_name{{.*}}"a"
; CHECK-NOT: DW_TAG
; CHECK-NOT: DW_AT_bit_offset
; CHECK-NOT: DW_AT_data_bit_offset
; CHECK: DW_AT_data_member_location [DW_FORM_data1] (0x00)
2016-12-22 08:45:21 +08:00
!9 = !DIBasicType ( name: "char" , size: 8 , encoding: D W _ A T E _ s i g n e d _ c h a r )
!10 = !DIDerivedType ( tag: D W _ T A G _ m e m b e r , name: "b" , scope: !6 , file: !3 , line: 6 , baseType: !11 , size: 5 , offset: 8 )
!11 = !DIDerivedType ( tag: D W _ T A G _ t y p e d e f , name: "uint32_t" , file: !12 , line: 183 , baseType: !13 )
!12 = !DIFile ( filename: "/Volumes/Data/llvm/_build.ninja.release/bin/../lib/clang/3.9.0/include/stdint.h" , directory: "/Volumes/Data/llvm" )
!13 = !DIBasicType ( name: "unsigned int" , size: 32 , encoding: D W _ A T E _ u n s i g n e d )
2016-04-28 23:37:48 +08:00
; CHECK: DW_TAG_member
; CHECK-NEXT: DW_AT_name{{.*}}"b"
; CHECK-NOT: DW_TAG
; CHECK-NOT: DW_AT_bit_offset
2016-05-17 06:45:10 +08:00
; CHECK-NOT: DW_AT_byte_size
; CHECK: DW_AT_bit_size [DW_FORM_data1] (0x05)
; CHECK-NOT: DW_AT_byte_size
; CHECK-NEXT: DW_AT_data_bit_offset [DW_FORM_data1] (0x08)
2016-05-17 10:37:53 +08:00
; CHECK-NOT: DW_AT_data_member_location
2016-12-22 08:45:21 +08:00
!14 = !DIDerivedType ( tag: D W _ T A G _ m e m b e r , name: "c" , scope: !6 , file: !3 , line: 7 , baseType: !11 , size: 27 , offset: 13 )
!15 = ! { i32 2 , !"Dwarf Version" , i32 4 }
!16 = ! { i32 2 , !"Debug Info Version" , i32 3 }
!17 = ! { i32 1 , !"PIC Level" , i32 2 }
2016-04-28 23:37:48 +08:00
; CHECK: DW_TAG_member
; CHECK-NEXT: DW_AT_name{{.*}}"c"
; CHECK-NOT: DW_TAG
; CHECK-NOT: DW_AT_bit_offset
2016-05-17 06:45:10 +08:00
; CHECK-NOT: DW_AT_byte_size
; CHECK: DW_AT_bit_size [DW_FORM_data1] (0x1b)
; CHECK-NEXT: DW_AT_data_bit_offset [DW_FORM_data1] (0x0d)
2016-05-17 10:37:53 +08:00
; CHECK-NOT: DW_AT_data_member_location
; CHECK: DW_TAG
2016-12-22 08:45:21 +08:00
!18 = ! { !"clang version 3.9.0 (trunk 267633)" }
2016-04-28 23:37:48 +08:00