[PATCH] D155070: [DWARFv5][DWARFLinker] Add stripped template names into .debug_names.

Alexey Lapshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 12 04:30:32 PDT 2023


avl created this revision.
avl added reviewers: JDevlieghere, aprantl, dblaikie, rastogishubham, fdeazeve.
Herald added a subscriber: hiraditya.
Herald added a project: All.
avl requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The D153869 <https://reviews.llvm.org/D153869> patch stopped storing stripped template names into
.debug_names accelerator table. This patch restores original
behavior as lldb relies on presenting stripped names. Changes for
llvm-dwarfdump would be done as a separate patch.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155070

Files:
  llvm/include/llvm/DWARFLinker/DWARFLinker.h
  llvm/lib/DWARFLinker/DWARFLinker.cpp
  llvm/test/tools/dsymutil/X86/dwarf5-accel.test


Index: llvm/test/tools/dsymutil/X86/dwarf5-accel.test
===================================================================
--- llvm/test/tools/dsymutil/X86/dwarf5-accel.test
+++ llvm/test/tools/dsymutil/X86/dwarf5-accel.test
@@ -1,5 +1,5 @@
 ## This test checks that DIE name with stripped template parameters
-## is not stored into .debug_name section.
+## is stored into .debug_name section.
 
 ## cat dwarf5-accel.cpp
 ##
@@ -13,15 +13,16 @@
 ## $ 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
+#COM: Uncomment next line when dwarfdump will handle stripped template names.
+#COM: llvm-dwarfdump --verify  %t.dSYM | FileCheck %s --check-prefix VERIFY
 #RUN: llvm-dwarfdump -a --verbose  %t.dSYM | FileCheck %s
 
-#VERIFY: No errors.
+#COM: Uncomment next line when dwarfdump will handle stripped template names.
+#COM: #VERIFY: No errors.
 
 #CHECK: .debug_names
-#CHECK-NOT: "foo"
+#CHECK: "foo"
 #CHECK: _Z3fooIcEvv
-#CHECK-NOT: "foo"
 #CHECK: "foo<char>"
 
 ---
Index: llvm/lib/DWARFLinker/DWARFLinker.cpp
===================================================================
--- llvm/lib/DWARFLinker/DWARFLinker.cpp
+++ llvm/lib/DWARFLinker/DWARFLinker.cpp
@@ -192,8 +192,7 @@
   if (!Info.MangledName)
     Info.MangledName = Info.Name;
 
-  if (StripTemplate && Linker.Options.CanStripTemplateName && Info.Name &&
-      Info.MangledName != Info.Name) {
+  if (StripTemplate && Info.Name && Info.MangledName != Info.Name) {
     StringRef Name = Info.Name.getString();
     if (std::optional<StringRef> StrippedName = StripTemplateParameters(Name))
       Info.NameWithoutTemplate = StringPool.getEntry(*StrippedName);
Index: llvm/include/llvm/DWARFLinker/DWARFLinker.h
===================================================================
--- llvm/include/llvm/DWARFLinker/DWARFLinker.h
+++ llvm/include/llvm/DWARFLinker/DWARFLinker.h
@@ -357,9 +357,6 @@
   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.
@@ -880,7 +877,6 @@
 
     /// The accelerator table kinds
     SmallVector<AccelTableKind, 1> AccelTables;
-    bool CanStripTemplateName = false;
 
     /// Prepend path for the clang modules.
     std::string PrependPath;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155070.539496.patch
Type: text/x-patch
Size: 2542 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230712/fcdfbff8/attachment.bin>


More information about the llvm-commits mailing list