[llvm] c3339bd - [DWARFv5][DWARFLinker] Add stripped template names into .debug_names.

Alexey Lapshin via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 13 02:14:53 PDT 2023


Author: Alexey Lapshin
Date: 2023-07-13T11:13:37+02:00
New Revision: c3339bd2fd65cc16ce7400ee3f90c3d12bfd3211

URL: https://github.com/llvm/llvm-project/commit/c3339bd2fd65cc16ce7400ee3f90c3d12bfd3211
DIFF: https://github.com/llvm/llvm-project/commit/c3339bd2fd65cc16ce7400ee3f90c3d12bfd3211.diff

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

The 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.

Differential Revision: https://reviews.llvm.org/D155070

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/DWARFLinker/DWARFLinker.h b/llvm/include/llvm/DWARFLinker/DWARFLinker.h
index 90834b6e3f9ba3..fe6789ceebaaaf 100644
--- a/llvm/include/llvm/DWARFLinker/DWARFLinker.h
+++ b/llvm/include/llvm/DWARFLinker/DWARFLinker.h
@@ -357,9 +357,6 @@ class DWARFLinker {
   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 @@ class DWARFLinker {
 
     /// The accelerator table kinds
     SmallVector<AccelTableKind, 1> AccelTables;
-    bool CanStripTemplateName = false;
 
     /// Prepend path for the clang modules.
     std::string PrependPath;

diff  --git a/llvm/lib/DWARFLinker/DWARFLinker.cpp b/llvm/lib/DWARFLinker/DWARFLinker.cpp
index ceeb26acee6a05..8eaf81f2b4844e 100644
--- a/llvm/lib/DWARFLinker/DWARFLinker.cpp
+++ b/llvm/lib/DWARFLinker/DWARFLinker.cpp
@@ -192,8 +192,7 @@ bool DWARFLinker::DIECloner::getDIENames(const DWARFDie &Die,
   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);

diff  --git a/llvm/test/tools/dsymutil/X86/dwarf5-accel.test b/llvm/test/tools/dsymutil/X86/dwarf5-accel.test
index 621fd80e623a61..2516d7681415b6 100644
--- a/llvm/test/tools/dsymutil/X86/dwarf5-accel.test
+++ b/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>"
 
 ---


        


More information about the llvm-commits mailing list