[Lldb-commits] [PATCH] D141318: [lldb] Store shared pointers in DieToTypePtr map instead of raw pointers

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jan 11 15:09:38 PST 2023


clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Each SymbolFile has its own type list that keeps the shared pointers to all types. So there should be no need for any of these changes here unless someone isn't correctly storing a newly created type in the SymbolFile's type list. You can see the types being stored in code like:

  TypeSP type_sp(... /* create type here*/ ...);
  dwarf->GetTypeList().Insert(type_sp); // Store the share reference in the symbol file's type list 



================
Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp:208-209
 
   dwarf->GetTypeList().Insert(type_sp);
-  dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get();
+  dwarf->GetDIEToType()[die.GetDIE()] = type_sp;
   clang::TagDecl *tag_decl = TypeSystemClang::GetAsTagDecl(type);
----------------
Above the "type_sp" is immediately stored in the SymbolFile's type list. So we don't need to do anything here and it _is_ safe to just store a "Type *".


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141318/new/

https://reviews.llvm.org/D141318



More information about the lldb-commits mailing list