1*fce0314cSAlexander Yermolovich; RUN: llc -filetype=obj -O0 -generate-type-units -mtriple=x86_64-unknown-linux-gnu < %s \ 2*fce0314cSAlexander Yermolovich; RUN: | llvm-dwarfdump -debug-info -debug-names - \ 3*fce0314cSAlexander Yermolovich; RUN: | FileCheck %s 4*fce0314cSAlexander Yermolovich 5*fce0314cSAlexander Yermolovich;; Test that an entry in the debug names table gets created for a top level DIE when the creation of TU fails. 6*fce0314cSAlexander Yermolovich 7*fce0314cSAlexander Yermolovich;; clang++ -O0 main.cpp -gdwarf-5 -fdebug-types-section -gpubnames -S -emit-llvm -glldb -o main.ll 8*fce0314cSAlexander Yermolovich;; int foo; 9*fce0314cSAlexander Yermolovich;; namespace { 10*fce0314cSAlexander Yermolovich;; struct t1 {}; 11*fce0314cSAlexander Yermolovich;; } // namespace 12*fce0314cSAlexander Yermolovich;; template <int *> struct t2 { 13*fce0314cSAlexander Yermolovich;; t1 v1; 14*fce0314cSAlexander Yermolovich;; }; 15*fce0314cSAlexander Yermolovich;; struct t3 { 16*fce0314cSAlexander Yermolovich;; t2<&foo> v1; 17*fce0314cSAlexander Yermolovich;; }; 18*fce0314cSAlexander Yermolovich;; t3 v1; 19*fce0314cSAlexander Yermolovich 20*fce0314cSAlexander Yermolovich; CHECK: [[OFFSET:0x[0-9a-f]*]]: DW_TAG_structure_type 21*fce0314cSAlexander Yermolovich; CHECK: [[OFFSET1:0x[0-9a-f]*]]: DW_TAG_structure_type 22*fce0314cSAlexander Yermolovich 23*fce0314cSAlexander Yermolovich; CHECK: Bucket 0 [ 24*fce0314cSAlexander Yermolovich; CHECK-NEXT: Name 1 { 25*fce0314cSAlexander Yermolovich; CHECK-NEXT: Hash: {{.+}} 26*fce0314cSAlexander Yermolovich; CHECK-NEXT: String: {{.+}} "t3" 27*fce0314cSAlexander Yermolovich; CHECK-NEXT: Entry @ {{.+}} { 28*fce0314cSAlexander Yermolovich; CHECK-NEXT: Abbrev: 0x1 29*fce0314cSAlexander Yermolovich; CHECK-NEXT: Tag: DW_TAG_structure_type 30*fce0314cSAlexander Yermolovich; CHECK-NEXT: DW_IDX_die_offset: [[OFFSET]] 31*fce0314cSAlexander Yermolovich; CHECK-NEXT: DW_IDX_parent: <parent not indexed> 32*fce0314cSAlexander Yermolovich 33*fce0314cSAlexander Yermolovich; CHECK: Name 5 { 34*fce0314cSAlexander Yermolovich; CHECK-NEXT: Hash: {{.+}} 35*fce0314cSAlexander Yermolovich; CHECK-NEXT: String: {{.+}} "t2<&foo>" 36*fce0314cSAlexander Yermolovich; CHECK-NEXT: Entry @ 0xe1 { 37*fce0314cSAlexander Yermolovich; CHECK-NEXT: Abbrev: 0x1 38*fce0314cSAlexander Yermolovich; CHECK-NEXT: Tag: DW_TAG_structure_type 39*fce0314cSAlexander Yermolovich; CHECK-NEXT: DW_IDX_die_offset: [[OFFSET1]] 40*fce0314cSAlexander Yermolovich; CHECK-NEXT: DW_IDX_parent: <parent not indexed> 41*fce0314cSAlexander Yermolovich 42*fce0314cSAlexander Yermolovich; ModuleID = 'main.cpp' 43*fce0314cSAlexander Yermolovichsource_filename = "main.cpp" 44*fce0314cSAlexander Yermolovichtarget datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" 45*fce0314cSAlexander Yermolovichtarget triple = "x86_64-unknown-linux-gnu" 46*fce0314cSAlexander Yermolovich 47*fce0314cSAlexander Yermolovich%struct.t3 = type { i8 } 48*fce0314cSAlexander Yermolovich 49*fce0314cSAlexander Yermolovich@foo = dso_local global i32 0, align 4, !dbg !0 50*fce0314cSAlexander Yermolovich@v1 = dso_local global %struct.t3 zeroinitializer, align 1, !dbg !5 51*fce0314cSAlexander Yermolovich 52*fce0314cSAlexander Yermolovich!llvm.dbg.cu = !{!2} 53*fce0314cSAlexander Yermolovich!llvm.module.flags = !{!20, !21, !22, !23, !24, !25, !26} 54*fce0314cSAlexander Yermolovich!llvm.ident = !{!27} 55*fce0314cSAlexander Yermolovich 56*fce0314cSAlexander Yermolovich!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) 57*fce0314cSAlexander Yermolovich!1 = distinct !DIGlobalVariable(name: "foo", scope: !2, file: !3, line: 1, type: !19, isLocal: false, isDefinition: true) 58*fce0314cSAlexander Yermolovich!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang version 20.0.0git (git@github.com:llvm/llvm-project.git ba373096e8ac83a7136fc44bc4e71a7bc53417a6)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !4, splitDebugInlining: false, sysroot: "/") 59*fce0314cSAlexander Yermolovich!3 = !DIFile(filename: "main.cpp", directory: "/StructuredType", checksumkind: CSK_MD5, checksum: "f91f8d905197b1c0309da9526bc4776e") 60*fce0314cSAlexander Yermolovich!4 = !{!0, !5} 61*fce0314cSAlexander Yermolovich!5 = !DIGlobalVariableExpression(var: !6, expr: !DIExpression()) 62*fce0314cSAlexander Yermolovich!6 = distinct !DIGlobalVariable(name: "v1", scope: !2, file: !3, line: 11, type: !7, isLocal: false, isDefinition: true) 63*fce0314cSAlexander Yermolovich!7 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "t3", file: !3, line: 8, size: 8, flags: DIFlagTypePassByValue, elements: !8, identifier: "_ZTS2t3") 64*fce0314cSAlexander Yermolovich!8 = !{!9} 65*fce0314cSAlexander Yermolovich!9 = !DIDerivedType(tag: DW_TAG_member, name: "v1", scope: !7, file: !3, line: 9, baseType: !10, size: 8) 66*fce0314cSAlexander Yermolovich!10 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "t2<&foo>", file: !3, line: 5, size: 8, flags: DIFlagTypePassByValue, elements: !11, templateParams: !16, identifier: "_ZTS2t2IXadL_Z3fooEEE") 67*fce0314cSAlexander Yermolovich!11 = !{!12} 68*fce0314cSAlexander Yermolovich!12 = !DIDerivedType(tag: DW_TAG_member, name: "v1", scope: !10, file: !3, line: 6, baseType: !13, size: 8) 69*fce0314cSAlexander Yermolovich!13 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "t1", scope: !14, file: !3, line: 3, size: 8, flags: DIFlagTypePassByValue, elements: !15) 70*fce0314cSAlexander Yermolovich!14 = !DINamespace(scope: null) 71*fce0314cSAlexander Yermolovich!15 = !{} 72*fce0314cSAlexander Yermolovich!16 = !{!17} 73*fce0314cSAlexander Yermolovich!17 = !DITemplateValueParameter(type: !18, value: ptr @foo) 74*fce0314cSAlexander Yermolovich!18 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !19, size: 64) 75*fce0314cSAlexander Yermolovich!19 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 76*fce0314cSAlexander Yermolovich!20 = !{i32 7, !"Dwarf Version", i32 5} 77*fce0314cSAlexander Yermolovich!21 = !{i32 2, !"Debug Info Version", i32 3} 78*fce0314cSAlexander Yermolovich!22 = !{i32 1, !"wchar_size", i32 4} 79*fce0314cSAlexander Yermolovich!23 = !{i32 8, !"PIC Level", i32 2} 80*fce0314cSAlexander Yermolovich!24 = !{i32 7, !"PIE Level", i32 2} 81*fce0314cSAlexander Yermolovich!25 = !{i32 7, !"uwtable", i32 2} 82*fce0314cSAlexander Yermolovich!26 = !{i32 7, !"frame-pointer", i32 2} 83*fce0314cSAlexander Yermolovich!27 = !{!"clang version 20.0.0git (git@github.com:llvm/llvm-project.git ba373096e8ac83a7136fc44bc4e71a7bc53417a6)"} 84