[Lldb-commits] [PATCH] D124110: Refactor protected virtual functions from SymbolFile into new SymbolFileActual class.

jeffrey tan via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 21 10:55:33 PDT 2022


yinghuitan added a comment.

Sounds good.

Here are the changes I plan to do:

1. Rename SymbolFileActual => SymbolFileCommon.
2. Inline SymbolFileCommon.h content into SymbolFile.h,
3. Move all remaining member fields of SymbolFile class into SymbolFileCommon.



================
Comment at: lldb/include/lldb/Symbol/SymbolFile.h:133-134
   // Compile Unit function calls
   // Approach 1 - iterator
-  uint32_t GetNumCompileUnits();
-  lldb::CompUnitSP GetCompileUnitAtIndex(uint32_t idx);
+  // Make virtual so that SymbolFileOnDemand can override.
+  virtual uint32_t GetNumCompileUnits() = 0;
----------------
labath wrote:
> The comment probably not necessary. In this setup, there's no way that a non-virtual method can make sense, as there is nothing one could use to implement it.
Sounds good.


================
Comment at: lldb/include/lldb/Symbol/SymbolFile.h:371-379
   lldb::ObjectFileSP m_objfile_sp; // Keep a reference to the object file in
                                    // case it isn't the same as the module
                                    // object file (debug symbols in a separate
                                    // file)
-  llvm::Optional<std::vector<lldb::CompUnitSP>> m_compile_units;
-  TypeList m_type_list;
   Symtab *m_symtab = nullptr;
   uint32_t m_abilities = 0;
   bool m_calculated_abilities = false;
----------------
labath wrote:
> What's up with the rest of the members. Can we move these too?
> Any member that stays here runs the risk of going out of sync when we have two instances floating around.
Sure, I can move them.
I did not do in this patch initially because I want to avoid change too much code and get further feedback. 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124110



More information about the lldb-commits mailing list