[Lldb-commits] [lldb] Make only one function that needs to be implemented when searching for types (PR #74786)

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Mon Dec 11 06:27:37 PST 2023


================
@@ -73,9 +73,22 @@ class DWARFDIE : public DWARFBaseDIE {
   std::vector<DWARFDIE> GetDeclContextDIEs() const;
 
   /// Return this DIE's decl context as it is needed to look up types
-  /// in Clang's -gmodules debug info format.
+  /// in Clang modules. This context will include any modules or functions that
+  /// the type is declared in so an exact module match can be efficiently made.
   std::vector<CompilerContext> GetDeclContext() const;
 
+  /// Get a context to a type so it can be looked up.
+  ///
+  /// This function uses the current DIE to fill in a CompilerContext array
+  /// that is suitable for type lookup for comparison to a TypeQuery's compiler
+  /// context (TypeQuery::GetContextRef()). If this DIE represents a named type,
+  /// it should fill out the compiler context with the type itself as the last
+  /// entry. The declaration context should be above the type and stop at an
+  /// appropriate time, like either the translation unit or at a function
+  /// context. This is designed to allow users to efficiently look for types
+  /// using a full or partial CompilerContext array.
+  std::vector<CompilerContext> GetTypeLookupContext() const;
----------------
Michael137 wrote:

Why can't we extend `GetDeclContext` to behave like `GetTypeLookupContext`? I'm probably missing something subtle about clang module lookup

https://github.com/llvm/llvm-project/pull/74786


More information about the lldb-commits mailing list