diff options
Diffstat (limited to 'llvm/test/DebugInfo/Generic')
| -rw-r--r-- | llvm/test/DebugInfo/Generic/PR20038.ll | 165 | ||||
| -rw-r--r-- | llvm/test/DebugInfo/Generic/discriminated-union.ll | 4 | ||||
| -rw-r--r-- | llvm/test/DebugInfo/Generic/dwarf-public-names.ll | 137 | ||||
| -rw-r--r-- | llvm/test/DebugInfo/Generic/member-order.ll | 63 | ||||
| -rw-r--r-- | llvm/test/DebugInfo/Generic/tu-composite.ll | 181 | ||||
| -rw-r--r-- | llvm/test/DebugInfo/Generic/univariant-discriminated-union.ll | 4 |
6 files changed, 550 insertions, 4 deletions
diff --git a/llvm/test/DebugInfo/Generic/PR20038.ll b/llvm/test/DebugInfo/Generic/PR20038.ll new file mode 100644 index 0000000..024a6ab --- /dev/null +++ b/llvm/test/DebugInfo/Generic/PR20038.ll @@ -0,0 +1,165 @@ +; For some reason, the output when targetting sparc is not quite as expected. +; XFAIL: target=sparc{{.*}} + +; RUN: %llc_dwarf -O0 -filetype=obj -dwarf-linkage-names=All < %s | llvm-dwarfdump -debug-info - | FileCheck %s --implicit-check-not=DW_TAG + +; IR generated from clang -O0 with: +; struct C { +; ~C(); +; }; +; extern bool b; +; void fun4() { b && (C(), 1); } +; __attribute__((always_inline)) C::~C() { } + +; CHECK: DW_TAG_compile_unit + +; CHECK: DW_TAG_structure_type +; CHECK: DW_AT_name ("C") +; CHECK: DW_TAG_subprogram +; CHECK: DW_AT_name ("~C") +; CHECK: DW_TAG_formal_parameter +; CHECK: DW_TAG_pointer_type + +; CHECK: DW_TAG_subprogram +; CHECK: DW_AT_linkage_name ("_ZN1CD1Ev") +; CHECK: DW_TAG_formal_parameter +; CHECK: DW_AT_name ("this") +; CHECK: DW_TAG_pointer_type + +; CHECK: DW_TAG_subprogram +; CHECK: DW_AT_name ("fun4") +; CHECK: DW_TAG_inlined_subroutine +; CHECK: DW_AT_abstract_origin {{.*}} "_ZN1CD1Ev" +; CHECK: DW_TAG_formal_parameter +; CHECK: DW_AT_abstract_origin {{.*}} "this" + +; CHECK: DW_TAG_subprogram +; CHECK: DW_AT_abstract_origin {{.*}} "_ZN1CD1Ev" +; CHECK: DW_TAG_formal_parameter +; CHECK: DW_AT_abstract_origin {{.*}} "this" + +; CHECK: DW_TAG_subprogram +; CHECK: DW_AT_linkage_name ("_ZN1CD2Ev") +; CHECK: DW_AT_specification {{.*}} "~C" +; CHECK: DW_TAG_formal_parameter +; CHECK: DW_AT_name ("this") + +%struct.C = type { i8 } + +@b = external global i8 + +; Function Attrs: nounwind +define void @_Z4fun4v() #0 !dbg !12 { +entry: + %this.addr.i.i = alloca ptr, align 8, !dbg !21 + %this.addr.i = alloca ptr, align 8, !dbg !22 + %agg.tmp.ensured = alloca %struct.C, align 1 + %cleanup.cond = alloca i1 + %0 = load i8, ptr @b, align 1, !dbg !24 + %tobool = trunc i8 %0 to i1, !dbg !24 + store i1 false, ptr %cleanup.cond + br i1 %tobool, label %land.rhs, label %land.end, !dbg !24 + +land.rhs: ; preds = %entry + store i1 true, ptr %cleanup.cond, !dbg !25 + br label %land.end + +land.end: ; preds = %land.rhs, %entry + %1 = phi i1 [ false, %entry ], [ true, %land.rhs ] + %cleanup.is_active = load i1, ptr %cleanup.cond, !dbg !27 + br i1 %cleanup.is_active, label %cleanup.action, label %cleanup.done, !dbg !27 + +cleanup.action: ; preds = %land.end + store ptr %agg.tmp.ensured, ptr %this.addr.i, align 8, !dbg !22 + call void @llvm.dbg.declare(metadata ptr %this.addr.i, metadata !129, metadata !DIExpression()), !dbg !31 + %this1.i = load ptr, ptr %this.addr.i, !dbg !22 + store ptr %this1.i, ptr %this.addr.i.i, align 8, !dbg !21 + call void @llvm.dbg.declare(metadata ptr %this.addr.i.i, metadata !132, metadata !DIExpression()), !dbg !33 + %this1.i.i = load ptr, ptr %this.addr.i.i, !dbg !21 + br label %cleanup.done, !dbg !22 + +cleanup.done: ; preds = %cleanup.action, %land.end + ret void, !dbg !34 +} + +; Function Attrs: alwaysinline nounwind +define void @_ZN1CD1Ev(ptr %this) unnamed_addr #1 align 2 !dbg !17 { +entry: + %this.addr.i = alloca ptr, align 8, !dbg !37 + %this.addr = alloca ptr, align 8 + store ptr %this, ptr %this.addr, align 8 + call void @llvm.dbg.declare(metadata ptr %this.addr, metadata !29, metadata !DIExpression()), !dbg !38 + %this1 = load ptr, ptr %this.addr + store ptr %this1, ptr %this.addr.i, align 8, !dbg !37 + call void @llvm.dbg.declare(metadata ptr %this.addr.i, metadata !232, metadata !DIExpression()), !dbg !39 + %this1.i = load ptr, ptr %this.addr.i, !dbg !37 + ret void, !dbg !37 +} + +; Function Attrs: alwaysinline nounwind +define void @_ZN1CD2Ev(ptr %this) unnamed_addr #1 align 2 !dbg !16 { +entry: + %this.addr = alloca ptr, align 8 + store ptr %this, ptr %this.addr, align 8 + call void @llvm.dbg.declare(metadata ptr %this.addr, metadata !32, metadata !DIExpression()), !dbg !40 + %this1 = load ptr, ptr %this.addr + ret void, !dbg !41 +} + +; Function Attrs: nounwind readnone +declare void @llvm.dbg.declare(metadata, metadata, metadata) #2 + +attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { alwaysinline nounwind "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #2 = { nounwind readnone } + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!18, !19} +!llvm.ident = !{!20} + +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !3, globals: !2, imports: !2) +!1 = !DIFile(filename: "<stdin>", directory: "/tmp/dbginfo") +!2 = !{} +!3 = !{!4} +!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "C", line: 1, size: 8, align: 8, file: !5, elements: !6, identifier: "_ZTS1C") +!5 = !DIFile(filename: "PR20038.cpp", directory: "/tmp/dbginfo") +!6 = !{!7} +!7 = !DISubprogram(name: "~C", line: 2, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !5, scope: !4, type: !8) +!8 = !DISubroutineType(types: !9) +!9 = !{null, !10} +!10 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !4) +!12 = distinct !DISubprogram(name: "fun4", linkageName: "_Z4fun4v", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 5, file: !5, scope: !13, type: !14, retainedNodes: !2) +!13 = !DIFile(filename: "PR20038.cpp", directory: "/tmp/dbginfo") +!14 = !DISubroutineType(types: !15) +!15 = !{null} +!16 = distinct !DISubprogram(name: "~C", linkageName: "_ZN1CD2Ev", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 6, file: !5, scope: !4, type: !8, declaration: !7, retainedNodes: !2) +!17 = distinct !DISubprogram(name: "~C", linkageName: "_ZN1CD1Ev", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 6, file: !5, scope: !4, type: !8, declaration: !7, retainedNodes: !2) +!18 = !{i32 2, !"Dwarf Version", i32 4} +!19 = !{i32 2, !"Debug Info Version", i32 3} +!20 = !{!"clang version 3.5.0 "} +!21 = !DILocation(line: 6, scope: !17, inlinedAt: !22) +!22 = !DILocation(line: 5, scope: !23) +!23 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !12) +!24 = !DILocation(line: 5, scope: !12) +!25 = !DILocation(line: 5, scope: !26) +!26 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !12) +!27 = !DILocation(line: 5, scope: !28) +!28 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !12) +!29 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !17, type: !30) +!30 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !4) +!31 = !DILocation(line: 0, scope: !17, inlinedAt: !22) +!32 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !16, type: !30) +!33 = !DILocation(line: 0, scope: !16, inlinedAt: !21) + +!129 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !17, type: !30) +!132 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !16, type: !30) +!232 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !16, type: !30) + +!34 = !DILocation(line: 5, scope: !35) +!35 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !36) +!36 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !12) +!37 = !DILocation(line: 6, scope: !17) +!38 = !DILocation(line: 0, scope: !17) +!39 = !DILocation(line: 0, scope: !16, inlinedAt: !37) +!40 = !DILocation(line: 0, scope: !16) +!41 = !DILocation(line: 6, scope: !16) diff --git a/llvm/test/DebugInfo/Generic/discriminated-union.ll b/llvm/test/DebugInfo/Generic/discriminated-union.ll index 6a42fea..0acf478 100644 --- a/llvm/test/DebugInfo/Generic/discriminated-union.ll +++ b/llvm/test/DebugInfo/Generic/discriminated-union.ll @@ -25,14 +25,14 @@ ; CHECK: DW_AT_alignment ; CHECK: DW_AT_data_member_location [DW_FORM_data1] (0x00) -%F = type { [0 x i8], i64, [8 x i8] } +%F = type { [0 x i8], ptr, [8 x i8] } %"F::Nope" = type {} define internal void @_ZN2e34main17h934ff72f9a38d4bbE() unnamed_addr #0 !dbg !5 { start: %qq = alloca %F, align 8 call void @llvm.dbg.declare(metadata ptr %qq, metadata !10, metadata !28), !dbg !29 - store i64 0, ptr %qq, !dbg !29 + store ptr null, ptr %qq, !dbg !29 ret void, !dbg !30 } diff --git a/llvm/test/DebugInfo/Generic/dwarf-public-names.ll b/llvm/test/DebugInfo/Generic/dwarf-public-names.ll new file mode 100644 index 0000000..bcb1617 --- /dev/null +++ b/llvm/test/DebugInfo/Generic/dwarf-public-names.ll @@ -0,0 +1,137 @@ +; RUN: %llc_dwarf -debugger-tune=gdb -filetype=obj -o %t.o < %s +; RUN: llvm-dwarfdump -debug-pubnames %t.o | FileCheck %s +; ModuleID = 'dwarf-public-names.cpp' +; +; Generated from: +; +; struct C { +; void member_function(); +; static int static_member_function(); +; static int static_member_variable; +; }; +; +; int C::static_member_variable = 0; +; +; void C::member_function() { +; static_member_variable = 0; +; } +; +; int C::static_member_function() { +; return static_member_variable; +; } +; +; C global_variable; +; +; int global_function() { +; return -1; +; } +; +; namespace ns { +; void global_namespace_function() { +; global_variable.member_function(); +; } +; int global_namespace_variable = 1; +; } + +; Skip the output to the header of the pubnames section. +; CHECK: debug_pubnames +; CHECK: version = 0x0002 + +; Check for each name in the output. +; CHECK-DAG: "ns" +; CHECK-DAG: "C::static_member_function" +; CHECK-DAG: "global_variable" +; CHECK-DAG: "ns::global_namespace_variable" +; CHECK-DAG: "ns::global_namespace_function" +; CHECK-DAG: "global_function" +; CHECK-DAG: "C::static_member_variable" +; CHECK-DAG: "C::member_function" + +source_filename = "test/DebugInfo/Generic/dwarf-public-names.ll" + +%struct.C = type { i8 } + +@_ZN1C22static_member_variableE = global i32 0, align 4, !dbg !0 +@global_variable = global %struct.C zeroinitializer, align 1, !dbg !15 +@_ZN2ns25global_namespace_variableE = global i32 1, align 4, !dbg !17 + +; Function Attrs: nounwind uwtable +define void @_ZN1C15member_functionEv(ptr %this) #0 align 2 !dbg !23 { +entry: + %this.addr = alloca ptr, align 8 + store ptr %this, ptr %this.addr, align 8 + call void @llvm.dbg.declare(metadata ptr %this.addr, metadata !24, metadata !26), !dbg !27 + %this1 = load ptr, ptr %this.addr + store i32 0, ptr @_ZN1C22static_member_variableE, align 4, !dbg !28 + ret void, !dbg !29 +} + +; Function Attrs: nounwind readnone +declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 + +; Function Attrs: nounwind uwtable +define i32 @_ZN1C22static_member_functionEv() #0 align 2 !dbg !30 { +entry: + %0 = load i32, ptr @_ZN1C22static_member_variableE, align 4, !dbg !31 + ret i32 %0, !dbg !31 +} + +; Function Attrs: nounwind uwtable +define i32 @_Z15global_functionv() #0 !dbg !32 { +entry: + ret i32 -1, !dbg !33 +} + +; Function Attrs: nounwind uwtable +define void @_ZN2ns25global_namespace_functionEv() #0 !dbg !34 { +entry: + call void @_ZN1C15member_functionEv(ptr @global_variable), !dbg !37 + ret void, !dbg !38 +} + +attributes #0 = { nounwind uwtable } +attributes #1 = { nounwind readnone } + +!llvm.dbg.cu = !{!20} +!llvm.module.flags = !{!22} + +!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) +!1 = !DIGlobalVariable(name: "static_member_variable", linkageName: "_ZN1C22static_member_variableE", scope: !2, file: !3, line: 7, type: !6, isLocal: false, isDefinition: true, declaration: !5) +!2 = !DICompositeType(tag: DW_TAG_structure_type, name: "C", file: !3, line: 1, size: 8, align: 8, elements: !4) +!3 = !DIFile(filename: "dwarf-public-names.cpp", directory: "/usr2/kparzysz/s.hex/t") +!4 = !{!5, !7, !12} +!5 = !DIDerivedType(tag: DW_TAG_member, name: "static_member_variable", scope: !2, file: !3, line: 4, baseType: !6, flags: DIFlagStaticMember) +!6 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) +!7 = !DISubprogram(name: "member_function", linkageName: "_ZN1C15member_functionEv", scope: !2, file: !3, line: 2, type: !8, isLocal: false, isDefinition: false, scopeLine: 2, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, retainedNodes: !11) +!8 = !DISubroutineType(types: !9) +!9 = !{null, !10} +!10 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !2, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer) +!11 = !{} +!12 = !DISubprogram(name: "static_member_function", linkageName: "_ZN1C22static_member_functionEv", scope: !2, file: !3, line: 3, type: !13, isLocal: false, isDefinition: false, scopeLine: 3, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, retainedNodes: !11) +!13 = !DISubroutineType(types: !14) +!14 = !{!6} +!15 = !DIGlobalVariableExpression(var: !16, expr: !DIExpression()) +!16 = !DIGlobalVariable(name: "global_variable", scope: null, file: !3, line: 17, type: !2, isLocal: false, isDefinition: true) ; previously: invalid DW_TAG_base_type +!17 = !DIGlobalVariableExpression(var: !18, expr: !DIExpression()) +!18 = !DIGlobalVariable(name: "global_namespace_variable", linkageName: "_ZN2ns25global_namespace_variableE", scope: !19, file: !3, line: 27, type: !6, isLocal: false, isDefinition: true) +!19 = !DINamespace(name: "ns", scope: null) +!20 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 3.3", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !11, retainedTypes: !11, globals: !21, imports: !11) ; previously: invalid DW_TAG_base_type +!21 = !{!0, !15, !17} +!22 = !{i32 1, !"Debug Info Version", i32 3} +!23 = distinct !DISubprogram(name: "member_function", linkageName: "_ZN1C15member_functionEv", scope: null, file: !3, line: 9, type: !8, isLocal: false, isDefinition: true, scopeLine: 9, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !20, declaration: !7, retainedNodes: !11) +!24 = !DILocalVariable(name: "this", arg: 1, scope: !23, file: !3, line: 9, type: !25, flags: DIFlagArtificial | DIFlagObjectPointer) +!25 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !2, size: 64, align: 64) +!26 = !DIExpression() +!27 = !DILocation(line: 9, scope: !23) +!28 = !DILocation(line: 10, scope: !23) +!29 = !DILocation(line: 11, scope: !23) +!30 = distinct !DISubprogram(name: "static_member_function", linkageName: "_ZN1C22static_member_functionEv", scope: null, file: !3, line: 13, type: !13, isLocal: false, isDefinition: true, scopeLine: 13, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !20, declaration: !12, retainedNodes: !11) +!31 = !DILocation(line: 14, scope: !30) +!32 = distinct !DISubprogram(name: "global_function", linkageName: "_Z15global_functionv", scope: !3, file: !3, line: 19, type: !13, isLocal: false, isDefinition: true, scopeLine: 19, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !20, retainedNodes: !11) +!33 = !DILocation(line: 20, scope: !32) +!34 = distinct !DISubprogram(name: "global_namespace_function", linkageName: "_ZN2ns25global_namespace_functionEv", scope: !19, file: !3, line: 24, type: !35, isLocal: false, isDefinition: true, scopeLine: 24, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !20, retainedNodes: !11) +!35 = !DISubroutineType(types: !36) +!36 = !{null} +!37 = !DILocation(line: 25, scope: !34) +!38 = !DILocation(line: 26, scope: !34) + diff --git a/llvm/test/DebugInfo/Generic/member-order.ll b/llvm/test/DebugInfo/Generic/member-order.ll new file mode 100644 index 0000000..a2965cc --- /dev/null +++ b/llvm/test/DebugInfo/Generic/member-order.ll @@ -0,0 +1,63 @@ +; RUN: %llc_dwarf -filetype=obj -O0 < %s | llvm-dwarfdump -debug-info - | FileCheck %s + +; generated by clang from: +; struct foo { +; void f1(); +; void f2(); +; }; +; +; void foo::f1() { +; } + +; CHECK: DW_TAG_structure_type +; CHECK-NEXT: DW_AT_name ("foo") +; CHECK-NOT: NULL +; CHECK: DW_TAG_subprogram +; CHECK-NOT: NULL +; CHECK: DW_AT_name ("f1") +; CHECK: DW_TAG_subprogram +; CHECK-NOT: NULL +; CHECK: DW_AT_name ("f2") + + +%struct.foo = type { i8 } + +; Function Attrs: nounwind uwtable +define void @_ZN3foo2f1Ev(ptr %this) #0 align 2 !dbg !14 { +entry: + %this.addr = alloca ptr, align 8 + store ptr %this, ptr %this.addr, align 8 + call void @llvm.dbg.declare(metadata ptr %this.addr, metadata !16, metadata !DIExpression()), !dbg !18 + %this1 = load ptr, ptr %this.addr + ret void, !dbg !19 +} + +; Function Attrs: nounwind readnone +declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 + +attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { nounwind readnone } + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!15, !20} + +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.4 ", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !3, globals: !2, imports: !2) +!1 = !DIFile(filename: "member-order.cpp", directory: "/tmp/dbginfo") +!2 = !{} +!3 = !{!4} +!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "foo", line: 1, size: 8, align: 8, file: !1, elements: !5, identifier: "_ZTS3foo") +!5 = !{!6, !11} +!6 = !DISubprogram(name: "f1", linkageName: "_ZN3foo2f1Ev", line: 2, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !1, scope: !4, type: !7) +!7 = !DISubroutineType(types: !8) +!8 = !{null, !9} +!9 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !4) +!10 = !{i32 786468} +!11 = !DISubprogram(name: "f2", linkageName: "_ZN3foo2f2Ev", line: 3, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 3, file: !1, scope: !4, type: !7) +!12 = !{i32 786468} +!14 = distinct !DISubprogram(name: "f1", linkageName: "_ZN3foo2f1Ev", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 6, file: !1, scope: null, type: !7, declaration: !6, retainedNodes: !2) +!15 = !{i32 2, !"Dwarf Version", i32 4} +!16 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !14, type: !17) +!17 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !4) +!18 = !DILocation(line: 0, scope: !14) +!19 = !DILocation(line: 7, scope: !14) +!20 = !{i32 1, !"Debug Info Version", i32 3} diff --git a/llvm/test/DebugInfo/Generic/tu-composite.ll b/llvm/test/DebugInfo/Generic/tu-composite.ll new file mode 100644 index 0000000..bcfe049 --- /dev/null +++ b/llvm/test/DebugInfo/Generic/tu-composite.ll @@ -0,0 +1,181 @@ +; RUN: %llc_dwarf -filetype=obj -O0 < %s > %t +; RUN: llvm-dwarfdump -v -debug-info %t | FileCheck %s +; CHECK: [[TYPE:.*]]: DW_TAG_structure_type +; Make sure we correctly handle containing type of a struct being a type identifier. +; CHECK-NEXT: DW_AT_containing_type [DW_FORM_ref4] (cu + {{.*}} => {[[TYPE]]} "C") +; CHECK-NEXT: DW_AT_name {{.*}}"C" + +; Make sure we correctly handle context of a subprogram being a type identifier. +; CHECK: [[SP:.*]]: DW_TAG_subprogram +; CHECK: DW_AT_name {{.*}}"foo" +; Make sure we correctly handle containing type of a subprogram being a type identifier. +; CHECK: DW_AT_containing_type [DW_FORM_ref4] (cu + {{.*}} => {[[TYPE]]} "C") +; CHECK: DW_TAG_formal_parameter +; CHECK: NULL +; CHECK: NULL + +; CHECK: [[TYPE2:.*]]: DW_TAG_structure_type +; CHECK: DW_AT_name {{.*}}"bar" +; CHECK: DW_TAG_structure_type +; CHECK: DW_AT_name {{.*}}"D" +; CHECK: DW_TAG_member +; CHECK: DW_AT_name {{.*}}"a" +; Make sure we correctly handle context of a struct being a type identifier. +; CHECK: DW_TAG_structure_type +; CHECK-NEXT: DW_AT_name {{.*}}"Nested" +; CHECK: DW_TAG_structure_type +; CHECK-NEXT: DW_AT_name {{.*}}"Nested2" +; CHECK-NEXT: DW_AT_declaration [DW_FORM_flag] (0x01) +; CHECK: DW_TAG_structure_type +; CHECK-NEXT: DW_AT_name {{.*}}"virt<bar>" +; Make sure we correctly handle type of a template_type being a type identifier. +; CHECK: DW_TAG_template_type_parameter +; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] (cu + {{.*}} => {[[TYPE2]]} +; CHECK-NEXT: DW_AT_name {{.*}}"T" +; Make sure we correctly handle derived-from of a typedef being a type identifier. +; CHECK: DW_TAG_typedef +; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] (cu + {{.*}} => {[[TYPE2]]} +; CHECK: DW_AT_name {{.*}}"baz2" +; Make sure we correctly handle derived-from of a pointer type being a type identifier. +; CHECK: DW_TAG_pointer_type +; CHECK: DW_AT_type [DW_FORM_ref4] (cu + {{.*}} => {[[TYPE]]} +; CHECK: DW_TAG_typedef +; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] (cu + {{.*}} => {[[TYPE2]]} +; CHECK: DW_AT_name {{.*}}"baz" +; Make sure we correctly handle derived-from of an array type being a type identifier. +; CHECK: DW_TAG_array_type +; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] (cu + {{.*}} => {[[TYPE2]]} +; IR generated from clang -g with the following source: +; struct C { +; virtual void foo(); +; }; +; void C::foo() { +; } +; +; struct bar { }; +; typedef bar baz; +; struct D { +; typedef bar baz2; +; static int a; +; struct Nested { }; +; struct Nested2 { }; +; template <typename T> +; struct virt { +; T* values; +; }; +; }; +; void test() { +; baz B; +; bar A[3]; +; D::baz2 B2; +; D::Nested e; +; D::Nested2 *p; +; D::virt<bar> t; +; } + +%struct.C = type { ptr } +%struct.bar = type { i8 } +%"struct.D::Nested" = type { i8 } +%"struct.D::Nested2" = type { i8 } +%"struct.D::virt" = type { ptr } + +@_ZTV1C = unnamed_addr constant [3 x ptr] [ptr null, ptr @_ZTI1C, ptr @_ZN1C3fooEv] +@_ZTVN10__cxxabiv117__class_type_infoE = external global ptr +@_ZTS1C = constant [3 x i8] c"1C\00" +@_ZTI1C = unnamed_addr constant { ptr, ptr } { ptr getelementptr inbounds (ptr, ptr @_ZTVN10__cxxabiv117__class_type_infoE, i64 2), ptr @_ZTS1C } + +; Function Attrs: nounwind ssp uwtable +define void @_ZN1C3fooEv(ptr %this) unnamed_addr #0 align 2 !dbg !31 { +entry: + %this.addr = alloca ptr, align 8 + store ptr %this, ptr %this.addr, align 8 + call void @llvm.dbg.declare(metadata ptr %this.addr, metadata !36, metadata !DIExpression()), !dbg !38 + %this1 = load ptr, ptr %this.addr + ret void, !dbg !39 +} + +; Function Attrs: nounwind readnone +declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 + +; Function Attrs: nounwind ssp uwtable +define void @_Z4testv() #0 !dbg !32 { +entry: + %B = alloca %struct.bar, align 1 + %A = alloca [3 x %struct.bar], align 1 + %B2 = alloca %struct.bar, align 1 + %e = alloca %"struct.D::Nested", align 1 + %p = alloca ptr, align 8 + %t = alloca %"struct.D::virt", align 8 + call void @llvm.dbg.declare(metadata ptr %B, metadata !40, metadata !DIExpression()), !dbg !42 + call void @llvm.dbg.declare(metadata ptr %A, metadata !43, metadata !DIExpression()), !dbg !47 + call void @llvm.dbg.declare(metadata ptr %B2, metadata !48, metadata !DIExpression()), !dbg !50 + call void @llvm.dbg.declare(metadata ptr %e, metadata !51, metadata !DIExpression()), !dbg !52 + call void @llvm.dbg.declare(metadata ptr %p, metadata !53, metadata !DIExpression()), !dbg !55 + call void @llvm.dbg.declare(metadata ptr %t, metadata !56, metadata !DIExpression()), !dbg !57 + ret void, !dbg !58 +} + +attributes #0 = { nounwind ssp uwtable "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { nounwind readnone } + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!35, !59} + +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.4", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !3, globals: !2, imports: !2) +!1 = !DIFile(filename: "tmp.cpp", directory: ".") +!2 = !{} +!3 = !{!4, !18, !19, !22, !23, !24} +!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "C", line: 1, file: !1, elements: !5, vtableHolder: !4, identifier: "_ZTS1C") +!5 = !{!6, !13} +!6 = !DIDerivedType(tag: DW_TAG_member, name: "_vptr$C", flags: DIFlagArtificial, file: !1, scope: !7, baseType: !8) +!7 = !DIFile(filename: "tmp.cpp", directory: ".") +!8 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, baseType: !9) +!9 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "__vtbl_ptr_type", size: 64, baseType: !10) +!10 = !DISubroutineType(types: !11) +!11 = !{!12} +!12 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) +!13 = !DISubprogram(name: "foo", linkageName: "_ZN1C3fooEv", line: 2, isLocal: false, isDefinition: false, virtuality: DW_VIRTUALITY_virtual, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !1, scope: !4, type: !14, containingType: !4) +!14 = !DISubroutineType(types: !15) +!15 = !{null, !16} +!16 = !DIDerivedType(tag: DW_TAG_pointer_type, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !4) +!18 = !DICompositeType(tag: DW_TAG_structure_type, name: "bar", line: 7, size: 8, align: 8, file: !1, elements: !2, identifier: "_ZTS3bar") +!19 = !DICompositeType(tag: DW_TAG_structure_type, name: "D", line: 9, size: 8, align: 8, file: !1, elements: !20, identifier: "_ZTS1D") +!20 = !{!21} +!21 = !DIDerivedType(tag: DW_TAG_member, name: "a", line: 11, flags: DIFlagStaticMember, file: !1, scope: !19, baseType: !12) +!22 = !DICompositeType(tag: DW_TAG_structure_type, name: "Nested", line: 12, size: 8, align: 8, file: !1, scope: !19, elements: !2, identifier: "_ZTSN1D6NestedE") +!23 = !DICompositeType(tag: DW_TAG_structure_type, name: "Nested2", line: 13, flags: DIFlagFwdDecl, file: !1, scope: !19, identifier: "_ZTSN1D7Nested2E") +!24 = !DICompositeType(tag: DW_TAG_structure_type, name: "virt<bar>", line: 15, file: !1, scope: !19, elements: !25, templateParams: !28, identifier: "_ZTSN1D4virtI3barEE") +!25 = !{!26} +!26 = !DIDerivedType(tag: DW_TAG_member, name: "values", line: 16, size: 64, align: 64, file: !1, scope: !24, baseType: !27) +!27 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !18) +!28 = !{!29} +!29 = !DITemplateTypeParameter(name: "T", type: !18) +!31 = distinct !DISubprogram(name: "foo", linkageName: "_ZN1C3fooEv", line: 4, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 4, file: !1, scope: null, type: !14, declaration: !13, retainedNodes: !2) +!32 = distinct !DISubprogram(name: "test", linkageName: "_Z4testv", line: 20, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 20, file: !1, scope: !7, type: !33, retainedNodes: !2) +!33 = !DISubroutineType(types: !34) +!34 = !{null} +!35 = !{i32 2, !"Dwarf Version", i32 3} +!36 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !31, type: !37) +!37 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !4) +!38 = !DILocation(line: 0, scope: !31) +!39 = !DILocation(line: 5, scope: !31) +!40 = !DILocalVariable(name: "B", line: 21, scope: !32, file: !7, type: !41) +!41 = !DIDerivedType(tag: DW_TAG_typedef, name: "baz", line: 8, file: !1, baseType: !18) +!42 = !DILocation(line: 21, scope: !32) +!43 = !DILocalVariable(name: "A", line: 22, scope: !32, file: !7, type: !44) +!44 = !DICompositeType(tag: DW_TAG_array_type, size: 24, align: 8, baseType: !18, elements: !45) +!45 = !{!46} +!46 = !DISubrange(count: 3) +!47 = !DILocation(line: 22, scope: !32) +!48 = !DILocalVariable(name: "B2", line: 23, scope: !32, file: !7, type: !49) +!49 = !DIDerivedType(tag: DW_TAG_typedef, name: "baz2", line: 10, file: !1, scope: !19, baseType: !18) +!50 = !DILocation(line: 23, scope: !32) +!51 = !DILocalVariable(name: "e", line: 24, scope: !32, file: !7, type: !22) +!52 = !DILocation(line: 24, scope: !32) +!53 = !DILocalVariable(name: "p", line: 25, scope: !32, file: !7, type: !54) +!54 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !23) +!55 = !DILocation(line: 25, scope: !32) +!56 = !DILocalVariable(name: "t", line: 26, scope: !32, file: !7, type: !24) +!57 = !DILocation(line: 26, scope: !32) +!58 = !DILocation(line: 27, scope: !32) +!59 = !{i32 1, !"Debug Info Version", i32 3} diff --git a/llvm/test/DebugInfo/Generic/univariant-discriminated-union.ll b/llvm/test/DebugInfo/Generic/univariant-discriminated-union.ll index a1849c7..628c2f8 100644 --- a/llvm/test/DebugInfo/Generic/univariant-discriminated-union.ll +++ b/llvm/test/DebugInfo/Generic/univariant-discriminated-union.ll @@ -12,14 +12,14 @@ ; CHECK: DW_AT_alignment ; CHECK: DW_AT_data_member_location [DW_FORM_data1] (0x00) -%F = type { [0 x i8], i64, [8 x i8] } +%F = type { [0 x i8], ptr, [8 x i8] } %"F::Nope" = type {} define internal void @_ZN2e34main17h934ff72f9a38d4bbE() unnamed_addr #0 !dbg !5 { start: %qq = alloca %F, align 8 call void @llvm.dbg.declare(metadata ptr %qq, metadata !10, metadata !28), !dbg !29 - store i64 0, ptr %qq, !dbg !29 + store ptr null, ptr %qq, !dbg !29 ret void, !dbg !30 } |
