Summary:
D76801 caused some regressions in debuginfo compatibility by changing how
certain functions were named.
For CodeView we try to mirror MSVC exactly: this was fixed in
a549c0d00486
For DWARF the situation is murkier. Per David Blaikie:
> In general DWARF doesn't specify this at all.
> [...]
> This isn't the only naming divergence between GCC and Clang
Nevertheless, including the space seems to provide better compatibility with
GCC and GDB. E.g. cpexprs.cc in the GDB testsuite requires this formatting.
And there was no particular desire to change the printing of names in debug
info in the first place (just in diagnostics and other more user-facing text).
Fixes PR46052
Reviewers: dblaikie, labath
Subscribers: aprantl, cfe-commits, dyung
Tags: #clang
Differential Revision: https://reviews.llvm.org/D80554
if (CGM.getCodeGenOpts().EmitCodeView) {
PP.MSVCFormatting = true;
PP.SplitTemplateClosers = true;
+ } else {
+ // For DWARF, printing rules are underspecified.
+ // SplitTemplateClosers yields better interop with GCC and GDB (PR46052).
+ PP.SplitTemplateClosers = true;
}
// Apply -fdebug-prefix-map.
};
j_wrap<j<int>> j_wrap_j;
// CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "j<int, int>"
-// CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "j_wrap<j<int, int>>"
+// CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "j_wrap<j<int, int> >"
template <typename T>
struct k {
// This type is not anchored in the module by an explicit template instantiation.
// CHECK: !DICompositeType(tag: DW_TAG_class_type,
-// CHECK-SAME: name: "Template<long, DebugCXX::traits<long>>",
+// CHECK-SAME: name: "Template<long, DebugCXX::traits<long> >",
// CHECK-SAME: scope: ![[NS]],
// CHECK-SAME: elements:
// CHECK-SAME: identifier: "_ZTSN8DebugCXX8TemplateIlNS_6traitsIlEEEE")
// This type is anchored in the module by an explicit template instantiation.
// CHECK: !DICompositeType(tag: DW_TAG_class_type,
-// CHECK-SAME: name: "Template<int, DebugCXX::traits<int>>",
+// CHECK-SAME: name: "Template<int, DebugCXX::traits<int> >",
// CHECK-SAME: scope: ![[NS]],
// CHECK-SAME: flags: DIFlagFwdDecl
// CHECK-SAME: identifier: "_ZTSN8DebugCXX8TemplateIiNS_6traitsIiEEEE")
// This one isn't.
// CHECK: !DICompositeType(tag: DW_TAG_class_type,
-// CHECK-SAME: name: "Template<float, DebugCXX::traits<float>>",
+// CHECK-SAME: name: "Template<float, DebugCXX::traits<float> >",
// CHECK-SAME: scope: ![[NS]],
// CHECK-SAME: elements:
// CHECK-SAME: templateParams:
// This type is anchored by an explicit template instantiation.
// CHECK: !DICompositeType(tag: DW_TAG_class_type,
-// CHECK-SAME: name: "Template<int, DebugCXX::traits<int>>"
+// CHECK-SAME: name: "Template<int, DebugCXX::traits<int> >"
// CHECK-SAME: elements:
// CHECK-SAME: templateParams:
// CHECK-SAME: identifier: "_ZTSN8DebugCXX8TemplateIiNS_6traitsIiEEEE")
// CHECK-SAME: identifier: "_ZTSN8DebugCXX6traitsIfEE")
// CHECK: !DICompositeType(tag: DW_TAG_class_type,
-// CHECK-SAME: name: "Template<long, DebugCXX::traits<long>>"
+// CHECK-SAME: name: "Template<long, DebugCXX::traits<long> >"
// CHECK-SAME: elements:
// CHECK-SAME: templateParams:
// CHECK-SAME: identifier: "_ZTSN8DebugCXX8TemplateIlNS_6traitsIlEEEE")
// no mangled name here yet.
// CHECK: !DICompositeType(tag: DW_TAG_class_type,
-// CHECK-SAME: name: "Template<float, DebugCXX::traits<float>>"
+// CHECK-SAME: name: "Template<float, DebugCXX::traits<float> >"
// CHECK-SAME: flags: DIFlagFwdDecl
// CHECK-SAME: identifier: "_ZTSN8DebugCXX8TemplateIfNS_6traitsIfEEEE")