1*9880d681SAndroid Build Coastguard Worker; REQUIRES: object-emission 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple x86_64-pc-linux -O0 -filetype=obj %s -o %t 4*9880d681SAndroid Build Coastguard Worker; RUN: llvm-dwarfdump %t | FileCheck %s 5*9880d681SAndroid Build Coastguard Worker 6*9880d681SAndroid Build Coastguard Worker; Testcase from: 7*9880d681SAndroid Build Coastguard Worker; struct base { 8*9880d681SAndroid Build Coastguard Worker; virtual ~base(); 9*9880d681SAndroid Build Coastguard Worker; }; 10*9880d681SAndroid Build Coastguard Worker; typedef base base_type; 11*9880d681SAndroid Build Coastguard Worker; struct foo { 12*9880d681SAndroid Build Coastguard Worker; base_type b; 13*9880d681SAndroid Build Coastguard Worker; }; 14*9880d681SAndroid Build Coastguard Worker; foo f; 15*9880d681SAndroid Build Coastguard Worker 16*9880d681SAndroid Build Coastguard Worker; Where member b should be seen as a field at an offset and not a bitfield. 17*9880d681SAndroid Build Coastguard Worker 18*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_member 19*9880d681SAndroid Build Coastguard Worker; CHECK: DW_AT_name{{.*}}"b" 20*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: DW_AT_bit_offset 21*9880d681SAndroid Build Coastguard Worker 22*9880d681SAndroid Build Coastguard Worker%struct.foo = type { %struct.base } 23*9880d681SAndroid Build Coastguard Worker%struct.base = type { i32 (...)** } 24*9880d681SAndroid Build Coastguard Worker 25*9880d681SAndroid Build Coastguard Worker$_ZN3fooC2Ev = comdat any 26*9880d681SAndroid Build Coastguard Worker 27*9880d681SAndroid Build Coastguard Worker$_ZN3fooD2Ev = comdat any 28*9880d681SAndroid Build Coastguard Worker 29*9880d681SAndroid Build Coastguard Worker$_ZN4baseC2Ev = comdat any 30*9880d681SAndroid Build Coastguard Worker 31*9880d681SAndroid Build Coastguard Worker@f = global %struct.foo zeroinitializer, align 8 32*9880d681SAndroid Build Coastguard Worker@__dso_handle = external global i8 33*9880d681SAndroid Build Coastguard Worker@_ZTV4base = external unnamed_addr constant [4 x i8*] 34*9880d681SAndroid Build Coastguard Worker@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__sub_I_decl_derived_member.cpp, i8* null }] 35*9880d681SAndroid Build Coastguard Worker 36*9880d681SAndroid Build Coastguard Workerdefine internal void @__cxx_global_var_init() section ".text.startup" !dbg !10 { 37*9880d681SAndroid Build Coastguard Workerentry: 38*9880d681SAndroid Build Coastguard Worker call void @_ZN3fooC2Ev(%struct.foo* @f) #2, !dbg !33 39*9880d681SAndroid Build Coastguard Worker %0 = call i32 @__cxa_atexit(void (i8*)* bitcast (void (%struct.foo*)* @_ZN3fooD2Ev to void (i8*)*), i8* bitcast (%struct.foo* @f to i8*), i8* @__dso_handle) #2, !dbg !33 40*9880d681SAndroid Build Coastguard Worker ret void, !dbg !33 41*9880d681SAndroid Build Coastguard Worker} 42*9880d681SAndroid Build Coastguard Worker 43*9880d681SAndroid Build Coastguard Worker; Function Attrs: inlinehint nounwind uwtable 44*9880d681SAndroid Build Coastguard Workerdefine linkonce_odr void @_ZN3fooC2Ev(%struct.foo* %this) unnamed_addr #0 comdat align 2 !dbg !14 { 45*9880d681SAndroid Build Coastguard Workerentry: 46*9880d681SAndroid Build Coastguard Worker %this.addr = alloca %struct.foo*, align 8 47*9880d681SAndroid Build Coastguard Worker store %struct.foo* %this, %struct.foo** %this.addr, align 8 48*9880d681SAndroid Build Coastguard Worker call void @llvm.dbg.declare(metadata %struct.foo** %this.addr, metadata !34, metadata !36), !dbg !37 49*9880d681SAndroid Build Coastguard Worker %this1 = load %struct.foo*, %struct.foo** %this.addr 50*9880d681SAndroid Build Coastguard Worker %b = getelementptr inbounds %struct.foo, %struct.foo* %this1, i32 0, i32 0, !dbg !38 51*9880d681SAndroid Build Coastguard Worker call void @_ZN4baseC2Ev(%struct.base* %b) #2, !dbg !38 52*9880d681SAndroid Build Coastguard Worker ret void, !dbg !38 53*9880d681SAndroid Build Coastguard Worker} 54*9880d681SAndroid Build Coastguard Worker 55*9880d681SAndroid Build Coastguard Worker; Function Attrs: inlinehint uwtable 56*9880d681SAndroid Build Coastguard Workerdefine linkonce_odr void @_ZN3fooD2Ev(%struct.foo* %this) unnamed_addr #1 comdat align 2 !dbg !24 { 57*9880d681SAndroid Build Coastguard Workerentry: 58*9880d681SAndroid Build Coastguard Worker %this.addr = alloca %struct.foo*, align 8 59*9880d681SAndroid Build Coastguard Worker store %struct.foo* %this, %struct.foo** %this.addr, align 8 60*9880d681SAndroid Build Coastguard Worker call void @llvm.dbg.declare(metadata %struct.foo** %this.addr, metadata !39, metadata !36), !dbg !40 61*9880d681SAndroid Build Coastguard Worker %this1 = load %struct.foo*, %struct.foo** %this.addr 62*9880d681SAndroid Build Coastguard Worker %b = getelementptr inbounds %struct.foo, %struct.foo* %this1, i32 0, i32 0, !dbg !41 63*9880d681SAndroid Build Coastguard Worker call void @_ZN4baseD1Ev(%struct.base* %b), !dbg !41 64*9880d681SAndroid Build Coastguard Worker ret void, !dbg !43 65*9880d681SAndroid Build Coastguard Worker} 66*9880d681SAndroid Build Coastguard Worker 67*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind 68*9880d681SAndroid Build Coastguard Workerdeclare i32 @__cxa_atexit(void (i8*)*, i8*, i8*) #2 69*9880d681SAndroid Build Coastguard Worker 70*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone 71*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.declare(metadata, metadata, metadata) #3 72*9880d681SAndroid Build Coastguard Worker 73*9880d681SAndroid Build Coastguard Worker; Function Attrs: inlinehint nounwind uwtable 74*9880d681SAndroid Build Coastguard Workerdefine linkonce_odr void @_ZN4baseC2Ev(%struct.base* %this) unnamed_addr #0 comdat align 2 !dbg !19 { 75*9880d681SAndroid Build Coastguard Workerentry: 76*9880d681SAndroid Build Coastguard Worker %this.addr = alloca %struct.base*, align 8 77*9880d681SAndroid Build Coastguard Worker store %struct.base* %this, %struct.base** %this.addr, align 8 78*9880d681SAndroid Build Coastguard Worker call void @llvm.dbg.declare(metadata %struct.base** %this.addr, metadata !44, metadata !36), !dbg !46 79*9880d681SAndroid Build Coastguard Worker %this1 = load %struct.base*, %struct.base** %this.addr 80*9880d681SAndroid Build Coastguard Worker %0 = bitcast %struct.base* %this1 to i32 (...)***, !dbg !47 81*9880d681SAndroid Build Coastguard Worker store i32 (...)** bitcast (i8** getelementptr inbounds ([4 x i8*], [4 x i8*]* @_ZTV4base, i64 0, i64 2) to i32 (...)**), i32 (...)*** %0, !dbg !47 82*9880d681SAndroid Build Coastguard Worker ret void, !dbg !47 83*9880d681SAndroid Build Coastguard Worker} 84*9880d681SAndroid Build Coastguard Worker 85*9880d681SAndroid Build Coastguard Workerdeclare void @_ZN4baseD1Ev(%struct.base*) #4 86*9880d681SAndroid Build Coastguard Worker 87*9880d681SAndroid Build Coastguard Workerdefine internal void @_GLOBAL__sub_I_decl_derived_member.cpp() section ".text.startup" { 88*9880d681SAndroid Build Coastguard Workerentry: 89*9880d681SAndroid Build Coastguard Worker call void @__cxx_global_var_init(), !dbg !48 90*9880d681SAndroid Build Coastguard Worker ret void 91*9880d681SAndroid Build Coastguard Worker} 92*9880d681SAndroid Build Coastguard Worker 93*9880d681SAndroid Build Coastguard Workerattributes #0 = { inlinehint nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } 94*9880d681SAndroid Build Coastguard Workerattributes #1 = { inlinehint uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } 95*9880d681SAndroid Build Coastguard Workerattributes #2 = { nounwind } 96*9880d681SAndroid Build Coastguard Workerattributes #3 = { nounwind readnone } 97*9880d681SAndroid Build Coastguard Workerattributes #4 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } 98*9880d681SAndroid Build Coastguard Worker 99*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!0} 100*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!30, !31} 101*9880d681SAndroid Build Coastguard Worker!llvm.ident = !{!32} 102*9880d681SAndroid Build Coastguard Worker 103*9880d681SAndroid Build Coastguard Worker!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.7.0 (trunk 227104) (llvm/trunk 227103)", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !3, globals: !28, imports: !2) 104*9880d681SAndroid Build Coastguard Worker!1 = !DIFile(filename: "decl-derived-member.cpp", directory: "/tmp/dbginfo") 105*9880d681SAndroid Build Coastguard Worker!2 = !{} 106*9880d681SAndroid Build Coastguard Worker!3 = !{!4, !8} 107*9880d681SAndroid Build Coastguard Worker!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "foo", line: 5, size: 64, align: 64, file: !1, elements: !5, identifier: "_ZTS3foo") 108*9880d681SAndroid Build Coastguard Worker!5 = !{!6} 109*9880d681SAndroid Build Coastguard Worker!6 = !DIDerivedType(tag: DW_TAG_member, name: "b", line: 6, size: 64, align: 64, file: !1, scope: !4, baseType: !7) 110*9880d681SAndroid Build Coastguard Worker!7 = !DIDerivedType(tag: DW_TAG_typedef, name: "base_type", line: 4, file: !1, baseType: !8) 111*9880d681SAndroid Build Coastguard Worker!8 = !DICompositeType(tag: DW_TAG_structure_type, name: "base", line: 1, flags: DIFlagFwdDecl, file: !1, identifier: "_ZTS4base") 112*9880d681SAndroid Build Coastguard Worker!10 = distinct !DISubprogram(name: "__cxx_global_var_init", line: 8, isLocal: true, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 8, file: !1, scope: !11, type: !12, variables: !2) 113*9880d681SAndroid Build Coastguard Worker!11 = !DIFile(filename: "decl-derived-member.cpp", directory: "/tmp/dbginfo") 114*9880d681SAndroid Build Coastguard Worker!12 = !DISubroutineType(types: !13) 115*9880d681SAndroid Build Coastguard Worker!13 = !{null} 116*9880d681SAndroid Build Coastguard Worker!14 = distinct !DISubprogram(name: "foo", linkageName: "_ZN3fooC2Ev", line: 5, isLocal: false, isDefinition: true, flags: DIFlagArtificial | DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 5, file: !1, scope: !4, type: !15, declaration: !18, variables: !2) 117*9880d681SAndroid Build Coastguard Worker!15 = !DISubroutineType(types: !16) 118*9880d681SAndroid Build Coastguard Worker!16 = !{null, !17} 119*9880d681SAndroid Build Coastguard Worker!17 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !4) 120*9880d681SAndroid Build Coastguard Worker!18 = !DISubprogram(name: "foo", isLocal: false, isDefinition: false, flags: DIFlagArtificial | DIFlagPrototyped, isOptimized: false, scope: !4, type: !15) 121*9880d681SAndroid Build Coastguard Worker!19 = distinct !DISubprogram(name: "base", linkageName: "_ZN4baseC2Ev", line: 1, isLocal: false, isDefinition: true, flags: DIFlagArtificial | DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 1, file: !1, scope: !8, type: !20, declaration: !23, variables: !2) 122*9880d681SAndroid Build Coastguard Worker!20 = !DISubroutineType(types: !21) 123*9880d681SAndroid Build Coastguard Worker!21 = !{null, !22} 124*9880d681SAndroid Build Coastguard Worker!22 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !8) 125*9880d681SAndroid Build Coastguard Worker!23 = !DISubprogram(name: "base", isLocal: false, isDefinition: false, flags: DIFlagArtificial | DIFlagPrototyped, isOptimized: false, scope: !8, type: !20) 126*9880d681SAndroid Build Coastguard Worker!24 = distinct !DISubprogram(name: "~foo", linkageName: "_ZN3fooD2Ev", line: 5, isLocal: false, isDefinition: true, flags: DIFlagArtificial | DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 5, file: !1, scope: !4, type: !15, declaration: !25, variables: !2) 127*9880d681SAndroid Build Coastguard Worker!25 = !DISubprogram(name: "~foo", isLocal: false, isDefinition: false, flags: DIFlagArtificial | DIFlagPrototyped, isOptimized: false, scope: !4, type: !15) 128*9880d681SAndroid Build Coastguard Worker!26 = distinct !DISubprogram(name: "", linkageName: "_GLOBAL__sub_I_decl_derived_member.cpp", isLocal: true, isDefinition: true, flags: DIFlagArtificial, isOptimized: false, unit: !0, file: !1, scope: !11, type: !27, variables: !2) 129*9880d681SAndroid Build Coastguard Worker!27 = !DISubroutineType(types: !2) 130*9880d681SAndroid Build Coastguard Worker!28 = !{!29} 131*9880d681SAndroid Build Coastguard Worker!29 = !DIGlobalVariable(name: "f", line: 8, isLocal: false, isDefinition: true, scope: null, file: !11, type: !4, variable: %struct.foo* @f) 132*9880d681SAndroid Build Coastguard Worker!30 = !{i32 2, !"Dwarf Version", i32 4} 133*9880d681SAndroid Build Coastguard Worker!31 = !{i32 2, !"Debug Info Version", i32 3} 134*9880d681SAndroid Build Coastguard Worker!32 = !{!"clang version 3.7.0 (trunk 227104) (llvm/trunk 227103)"} 135*9880d681SAndroid Build Coastguard Worker!33 = !DILocation(line: 8, column: 5, scope: !10) 136*9880d681SAndroid Build Coastguard Worker!34 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !14, type: !35) 137*9880d681SAndroid Build Coastguard Worker!35 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !4) 138*9880d681SAndroid Build Coastguard Worker!36 = !DIExpression() 139*9880d681SAndroid Build Coastguard Worker!37 = !DILocation(line: 0, scope: !14) 140*9880d681SAndroid Build Coastguard Worker!38 = !DILocation(line: 5, column: 8, scope: !14) 141*9880d681SAndroid Build Coastguard Worker!39 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !24, type: !35) 142*9880d681SAndroid Build Coastguard Worker!40 = !DILocation(line: 0, scope: !24) 143*9880d681SAndroid Build Coastguard Worker!41 = !DILocation(line: 5, column: 8, scope: !42) 144*9880d681SAndroid Build Coastguard Worker!42 = distinct !DILexicalBlock(line: 5, column: 8, file: !1, scope: !24) 145*9880d681SAndroid Build Coastguard Worker!43 = !DILocation(line: 5, column: 8, scope: !24) 146*9880d681SAndroid Build Coastguard Worker!44 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !19, type: !45) 147*9880d681SAndroid Build Coastguard Worker!45 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !8) 148*9880d681SAndroid Build Coastguard Worker!46 = !DILocation(line: 0, scope: !19) 149*9880d681SAndroid Build Coastguard Worker!47 = !DILocation(line: 1, column: 8, scope: !19) 150*9880d681SAndroid Build Coastguard Worker!48 = !DILocation(line: 0, scope: !26) 151