[Lldb-commits] [PATCH] D115308: [LLDB][DWARF] Fix duplicate TypeSP in type list

Zequan Wu via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Dec 7 16:46:08 PST 2021


zequanwu created this revision.
zequanwu added reviewers: labath, shafik, teemperor.
zequanwu requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115308

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-type.cpp


Index: lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-type.cpp
===================================================================
--- lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-type.cpp
+++ lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-type.cpp
@@ -8,6 +8,7 @@
 // RUN:   FileCheck --check-prefix=CONTEXT %s
 // RUN: lldb-test symbols --name=not_there --find=type %t | \
 // RUN:   FileCheck --check-prefix=EMPTY %s
+// RUN: lldb-test symbols --find=none %t | FileCheck --check-prefix=TYPES %s
 //
 // RUN: %clang %s -g -c -o %t --target=x86_64-apple-macosx
 // RUN: lldb-test symbols --name=foo --find=type %t | \
@@ -16,6 +17,7 @@
 // RUN:   FileCheck --check-prefix=CONTEXT %s
 // RUN: lldb-test symbols --name=not_there --find=type %t | \
 // RUN:   FileCheck --check-prefix=EMPTY %s
+// RUN: lldb-test symbols --find=none %t | FileCheck --check-prefix=TYPES %s
 
 // RUN: %clang %s -c -o %t.o --target=x86_64-pc-linux -gdwarf-5 -gpubnames
 // RUN: ld.lld %t.o -o %t
@@ -26,6 +28,7 @@
 // RUN:   FileCheck --check-prefix=CONTEXT %s
 // RUN: lldb-test symbols --name=not_there --find=type %t | \
 // RUN:   FileCheck --check-prefix=EMPTY %s
+// RUN: lldb-test symbols --find=none %t | FileCheck --check-prefix=TYPES %s
 
 // NAMES: Name: .debug_names
 
@@ -34,25 +37,32 @@
 // CONTEXT: Found 1 types:
 struct foo { };
 // NAME-DAG: name = "foo", {{.*}} decl = find-basic-type.cpp:[[@LINE-1]]
+// TYPES: name = "foo", size = 1, decl = find-basic-type.cpp:[[@LINE-2]]
 
 namespace bar {
 int context;
 struct foo {};
 // NAME-DAG: name = "foo", {{.*}} decl = find-basic-type.cpp:[[@LINE-1]]
 // CONTEXT-DAG: name = "foo", {{.*}} decl = find-basic-type.cpp:[[@LINE-2]]
+// TYPES: name = "foo", size = 1, decl = find-basic-type.cpp:[[@LINE-3]]
 namespace baz {
 struct foo {};
 // NAME-DAG: name = "foo", {{.*}} decl = find-basic-type.cpp:[[@LINE-1]]
+// TYPES: name = "foo", size = 1, decl = find-basic-type.cpp:[[@LINE-2]]
 }
 }
 
 struct sbar {
+  // TYPES: name = "sbar", size = 1, decl = find-basic-type.cpp:[[@LINE-1]]
   struct foo {};
-// NAME-DAG: name = "foo", {{.*}} decl = find-basic-type.cpp:[[@LINE-1]]
+  // NAME-DAG: name = "foo", {{.*}} decl = find-basic-type.cpp:[[@LINE-1]]
+  // TYPES: name = "foo", size = 1, decl = find-basic-type.cpp:[[@LINE-2]]
 };
 
 struct foobar {};
+// TYPES: name = "foobar", size = 1, decl = find-basic-type.cpp:[[@LINE-1]]
 
 struct Foo {};
+// TYPES: name = "Foo", size = 1, decl = find-basic-type.cpp:[[@LINE-1]]
 
 extern "C" void _start(foo, bar::foo, bar::baz::foo, sbar::foo, foobar, Foo) {}
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -1530,7 +1530,6 @@
     return type_sp;
 
   SymbolFileDWARF *dwarf = die.GetDWARF();
-  TypeList &type_list = dwarf->GetTypeList();
   DWARFDIE sc_parent_die = SymbolFileDWARF::GetParentSymbolContextDIE(die);
   dw_tag_t sc_parent_tag = sc_parent_die.Tag();
 
@@ -1550,10 +1549,6 @@
   if (symbol_context_scope != nullptr)
     type_sp->SetSymbolContextScope(symbol_context_scope);
 
-  // We are ready to put this type into the uniqued list up at the module
-  // level.
-  type_list.Insert(type_sp);
-
   dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get();
   return type_sp;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115308.392599.patch
Type: text/x-patch
Size: 3406 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20211208/07b0b558/attachment.bin>


More information about the lldb-commits mailing list