forked from OSchip/llvm-project
DebugInfo: Make the simplified template names prefix more unique
This commit is contained in:
parent
2232d35f82
commit
6b306233f7
|
@ -5199,7 +5199,7 @@ std::string CGDebugInfo::GetName(const Decl *D, bool Qualified) const {
|
|||
TemplateNamesKind == codegenoptions::DebugTemplateNamesKind::Mangled;
|
||||
// check if it's a template
|
||||
if (Mangled)
|
||||
OS << "_STN";
|
||||
OS << "_STN|";
|
||||
|
||||
OS << ND->getDeclName();
|
||||
std::string EncodedOriginalName;
|
||||
|
|
|
@ -35,20 +35,20 @@ t4 v1;
|
|||
void f() {
|
||||
// Basic examples of simplifiable/rebuildable names
|
||||
f1<>();
|
||||
// CHECK: !DISubprogram(name: "_STNf1|<>",
|
||||
// CHECK: !DISubprogram(name: "_STN|f1|<>",
|
||||
// SIMPLE: !DISubprogram(name: "f1",
|
||||
// FULL: !DISubprogram(name: "f1<>",
|
||||
f1<int>();
|
||||
// CHECK: !DISubprogram(name: "_STNf1|<int>",
|
||||
// CHECK: !DISubprogram(name: "_STN|f1|<int>",
|
||||
f1<void()>();
|
||||
// CHECK: !DISubprogram(name: "_STNf1|<void ()>",
|
||||
// CHECK: !DISubprogram(name: "_STN|f1|<void ()>",
|
||||
f2<int, 42>();
|
||||
// CHECK: !DISubprogram(name: "_STNf2|<int, 42>",
|
||||
// CHECK: !DISubprogram(name: "_STN|f2|<int, 42>",
|
||||
|
||||
// Check that even though the nested name can't be rebuilt, it'll carry its
|
||||
// full name and the outer name can be rebuilt from that.
|
||||
f1<t1<void() noexcept>>();
|
||||
// CHECK: !DISubprogram(name: "_STNf1|<t1<void () noexcept> >",
|
||||
// CHECK: !DISubprogram(name: "_STN|f1|<t1<void () noexcept> >",
|
||||
|
||||
// Vector array types are encoded in DWARF but the decoding in llvm-dwarfdump
|
||||
// isn't implemented yet.
|
||||
|
@ -109,7 +109,7 @@ void f() {
|
|||
// worry about seeing conversion operators as parameters to other templates.
|
||||
|
||||
f3<t1>();
|
||||
// CHECK: !DISubprogram(name: "_STNf3|<t1>",
|
||||
// CHECK: !DISubprogram(name: "_STN|f3|<t1>",
|
||||
|
||||
f1<_BitInt(3)>();
|
||||
// CHECK: !DISubprogram(name: "f1<_BitInt(3)>",
|
||||
|
|
|
@ -1509,7 +1509,7 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
|
|||
// DICompositeType flag specifying whether template parameters are
|
||||
// required on declarations of this type.
|
||||
StringRef NameStr = Name->getString();
|
||||
if (!NameStr.contains('<') || NameStr.startswith("_STN"))
|
||||
if (!NameStr.contains('<') || NameStr.startswith("_STN|"))
|
||||
TemplateParams = getMDOrNull(Record[14]);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -291,7 +291,7 @@ struct DWARFTypePrinter {
|
|||
}
|
||||
Word = true;
|
||||
StringRef Name = NamePtr;
|
||||
static constexpr StringRef MangledPrefix = "_STN";
|
||||
static constexpr StringRef MangledPrefix = "_STN|";
|
||||
if (Name.startswith(MangledPrefix)) {
|
||||
Name = Name.drop_front(MangledPrefix.size());
|
||||
auto Separator = Name.find('|');
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
; };
|
||||
; ref_templ_non_tu_simple v3;
|
||||
;
|
||||
; // Modify templ_non_tu<bool>'s name to be mangled ('_STN' name '|' args)
|
||||
; // Modify templ_non_tu<bool>'s name to be mangled ('_STN|' name '|' args)
|
||||
; template <>
|
||||
; struct templ_non_tu<bool> {
|
||||
; virtual void f1();
|
||||
|
@ -117,7 +117,7 @@
|
|||
; CHECK: DW_AT_name {{.*}}"ref_templ_non_tu"
|
||||
; CHECK: DW_TAG_structure_type
|
||||
; CHECK-NOT: DW_TAG
|
||||
; CHECK: DW_AT_name {{.*}}"_STNtempl_non_tu|<int>"
|
||||
; CHECK: DW_AT_name {{.*}}"_STN|templ_non_tu|<int>"
|
||||
|
||||
; CHECK: DW_TAG_structure_type
|
||||
; CHECK-NOT: DW_TAG
|
||||
|
@ -134,7 +134,7 @@
|
|||
; CHECK: DW_AT_name {{.*}}"ref_templ_non_tu_mangled"
|
||||
; CHECK: DW_TAG_structure_type
|
||||
; CHECK-NOT: DW_TAG
|
||||
; CHECK: DW_AT_name ("_STNtempl_non_tu|<bool>")
|
||||
; CHECK: DW_AT_name ("_STN|templ_non_tu|<bool>")
|
||||
; CHECK-NOT: DW_TAG
|
||||
; CHECK: DW_TAG_template_type_parameter
|
||||
; CHECK-NEXT: DW_AT_type {{.*}}"bool"
|
||||
|
@ -244,7 +244,7 @@ attributes #1 = { nofree nosync nounwind readnone speculatable willreturn }
|
|||
!15 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "ref_templ_non_tu", file: !3, line: 30, size: 64, flags: DIFlagTypePassByReference | DIFlagNonTrivial, elements: !16, identifier: "_ZTS16ref_templ_non_tu")
|
||||
!16 = !{!17}
|
||||
!17 = !DIDerivedType(tag: DW_TAG_member, name: "v1", scope: !15, file: !3, line: 31, baseType: !18, size: 64)
|
||||
!18 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "_STNtempl_non_tu|<int>", file: !3, line: 26, size: 64, flags: DIFlagTypePassByReference | DIFlagNonTrivial, elements: !19, vtableHolder: !18, templateParams: !30)
|
||||
!18 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "_STN|templ_non_tu|<int>", file: !3, line: 26, size: 64, flags: DIFlagTypePassByReference | DIFlagNonTrivial, elements: !19, vtableHolder: !18, templateParams: !30)
|
||||
!19 = !{!20, !26}
|
||||
!20 = !DIDerivedType(tag: DW_TAG_member, name: "_vptr$templ_non_tu", scope: !3, file: !3, baseType: !21, size: 64, flags: DIFlagArtificial)
|
||||
!21 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !22, size: 64)
|
||||
|
@ -277,7 +277,7 @@ attributes #1 = { nofree nosync nounwind readnone speculatable willreturn }
|
|||
!48 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "ref_templ_non_tu_mangled", file: !3, line: 53, size: 64, flags: DIFlagTypePassByReference | DIFlagNonTrivial, elements: !49, identifier: "_ZTS24ref_templ_non_tu_mangled")
|
||||
!49 = !{!50}
|
||||
!50 = !DIDerivedType(tag: DW_TAG_member, name: "v1", scope: !48, file: !3, line: 54, baseType: !51, size: 64)
|
||||
!51 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "_STNtempl_non_tu|<bool>", file: !3, line: 49, size: 64, flags: DIFlagTypePassByReference | DIFlagNonTrivial, elements: !52, vtableHolder: !51, templateParams: !57)
|
||||
!51 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "_STN|templ_non_tu|<bool>", file: !3, line: 49, size: 64, flags: DIFlagTypePassByReference | DIFlagNonTrivial, elements: !52, vtableHolder: !51, templateParams: !57)
|
||||
!52 = !{!20, !53}
|
||||
!53 = !DISubprogram(name: "f1", linkageName: "_ZN12templ_non_tuIbE2f1Ev", scope: !51, file: !3, line: 50, type: !54, scopeLine: 50, containingType: !51, virtualIndex: 0, flags: DIFlagPrototyped, spFlags: DISPFlagVirtual)
|
||||
!54 = !DISubroutineType(types: !55)
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
; CHECK: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "struct", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: 309, size: 128, flags: DIFlagFwdDecl, templateParams: !{{[0-9]+}}, identifier: "struct_templ_simplified")
|
||||
; CHECK: distinct !DICompositeType(tag: DW_TAG_union_type, file: !{{[0-9]+}}, line: 115, size: 384, flags: DIFlagFwdDecl, identifier: "union")
|
||||
; CHECK: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "struct<>", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: 309, size: 128, flags: DIFlagFwdDecl, identifier: "struct_templ")
|
||||
; CHECK: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "_STNstruct|<>", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: 309, size: 128, flags: DIFlagFwdDecl, templateParams: !{{[0-9]+}}, identifier: "struct_templ_simplified_mangled")
|
||||
; CHECK: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "_STN|struct|<>", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: 309, size: 128, flags: DIFlagFwdDecl, templateParams: !{{[0-9]+}}, identifier: "struct_templ_simplified_mangled")
|
||||
|
||||
; Ensure that full type definitions of composite types are imported if requested
|
||||
; RUN: llvm-lto -import-full-type-definitions -thinlto-action=import %t2.bc -thinlto-index=%t.index.bc -o - | llvm-dis -o - | FileCheck %s --check-prefix=FULL
|
||||
|
@ -34,7 +34,7 @@
|
|||
; FULL: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "struct", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: 309, baseType: !{{[0-9]+}}, size: 128, offset: 64, elements: !{{[0-9]+}}, vtableHolder: !{{[0-9]+}}, templateParams: !{{[0-9]+}}, identifier: "struct_templ_simplified")
|
||||
; FULL: distinct !DICompositeType(tag: DW_TAG_union_type, file: !{{[0-9]+}}, line: 115, size: 384, elements: !{{[0-9]+}}, identifier: "union")
|
||||
; FULL: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "struct<>", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: 309, baseType: !{{[0-9]+}}, size: 128, offset: 64, elements: !{{[0-9]+}}, vtableHolder: !{{[0-9]+}}, templateParams: !{{[0-9]+}}, identifier: "struct_templ")
|
||||
; FULL: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "_STNstruct|<>", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: 309, baseType: !{{[0-9]+}}, size: 128, offset: 64, elements: !{{[0-9]+}}, vtableHolder: !{{[0-9]+}}, templateParams: !{{[0-9]+}}, identifier: "struct_templ_simplified_mangled")
|
||||
; FULL: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "_STN|struct|<>", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: 309, baseType: !{{[0-9]+}}, size: 128, offset: 64, elements: !{{[0-9]+}}, vtableHolder: !{{[0-9]+}}, templateParams: !{{[0-9]+}}, identifier: "struct_templ_simplified_mangled")
|
||||
|
||||
; ModuleID = 'debuginfo-compositetype-import.c'
|
||||
source_filename = "debuginfo-compositetype-import.c"
|
||||
|
@ -65,4 +65,4 @@ entry:
|
|||
!11 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "struct", scope: !1, file: !1, line: 309, baseType: !10, size: 128, offset: 64, elements: !5, vtableHolder: !10, templateParams: !5, identifier: "struct_templ_simplified")
|
||||
!12 = distinct !DICompositeType(tag: DW_TAG_union_type, file: !1, line: 115, size: 384, elements: !5, identifier: "union")
|
||||
!13 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "struct<>", scope: !1, file: !1, line: 309, baseType: !10, size: 128, offset: 64, elements: !5, vtableHolder: !10, templateParams: !5, identifier: "struct_templ")
|
||||
!14 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "_STNstruct|<>", scope: !1, file: !1, line: 309, baseType: !10, size: 128, offset: 64, elements: !5, vtableHolder: !10, templateParams: !5, identifier: "struct_templ_simplified_mangled")
|
||||
!14 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "_STN|struct|<>", scope: !1, file: !1, line: 309, baseType: !10, size: 128, offset: 64, elements: !5, vtableHolder: !10, templateParams: !5, identifier: "struct_templ_simplified_mangled")
|
||||
|
|
|
@ -135,7 +135,7 @@ v1:
|
|||
.Linfo_string5:
|
||||
.asciz "T" # string offset=162
|
||||
.Linfo_string6:
|
||||
.asciz "_STNt1|<it>" # string offset=164
|
||||
.asciz "_STN|t1|<it>" # string offset=164
|
||||
.ident "clang version 14.0.0 (git@github.com:llvm/llvm-project.git 9daec0955132e6e33b086edc63c6f3e0f5712323)"
|
||||
.section ".note.GNU-stack","",@progbits
|
||||
.addrsig
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue