void addAccelTableKind(AccelTableKind Kind) {
assert(!llvm::is_contained(Options.AccelTables, Kind));
Options.AccelTables.emplace_back(Kind);
+
+ if (Kind == AccelTableKind::Apple)
+ Options.CanStripTemplateName = true;
}
/// Set prepend path for clang modules.
/// The accelerator table kinds
SmallVector<AccelTableKind, 1> AccelTables;
+ bool CanStripTemplateName = false;
/// Prepend path for the clang modules.
std::string PrependPath;
if (!Info.MangledName)
Info.MangledName = Info.Name;
- if (StripTemplate && Info.Name && Info.MangledName != Info.Name) {
+ if (StripTemplate && Linker.Options.CanStripTemplateName && Info.Name &&
+ Info.MangledName != Info.Name) {
StringRef Name = Info.Name.getString();
if (std::optional<StringRef> StrippedName = StripTemplateParameters(Name))
Info.NameWithoutTemplate = StringPool.getEntry(*StrippedName);
--- /dev/null
+## This test checks that DIE name with stripped template parameters
+## is not stored into .debug_name section.
+
+## cat dwarf5-accel.cpp
+##
+## template<typename A> void foo() {};
+##
+## int main ( void ) {
+## foo<char>();
+## return 0;
+## }
+
+## $ clang -gdwarf-5 dwarf5-accel.cpp -c -o dwarf5-accel.o
+
+#RUN: dsymutil -accelerator=Dwarf -oso-prepend-path %p/Inputs -y %s -o %t.dSYM
+#RUN: llvm-dwarfdump --verify %t.dSYM | FileCheck %s --check-prefix VERIFY
+#RUN: llvm-dwarfdump -a --verbose %t.dSYM | FileCheck %s
+
+#VERIFY: No errors.
+
+#CHECK: .debug_names
+#CHECK-NOT: "foo"
+#CHECK: _Z3fooIcEvv
+#CHECK-NOT: "foo"
+#CHECK: "foo<char>"
+
+---
+triple: 'x86_64-apple-darwin'
+objects:
+ - filename: 'dwarf5-accel.o'
+ timestamp: 1676048242
+ symbols:
+ - { sym: _main, objAddr: 0x0000000000000000, binAddr: 0x0000000100000AB0, size: 0x00000008 }
+ - { sym: __Z3fooIcEvv, objAddr: 0x0000000000000020, binAddr: 0x0000000100000BB0, size: 0x00000008 }