[Lldb-commits] [lldb] Fix type lookup bug where wrong decl context was being used for a DIE. (PR #94846)

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Sat Jun 8 00:53:37 PDT 2024


================
@@ -491,6 +491,18 @@ static void GetTypeLookupContextImpl(DWARFDIE die,
     case DW_TAG_base_type:
       push_ctx(CompilerContextKind::Builtin, name);
       break;
+    // If any of the tags below appear in the parent chain, stop the decl
+    // context and return. Prior to these being in here, if a type existed in a
+    // namespace "a" like "a::my_struct", but we also have a function in that
+    // same namespace "a" which contained a type named "my_struct", both would
+    // return "a::my_struct" as the declaration context since the
+    // DW_TAG_subprogram would be skipped and its parent would be found.
+    case DW_TAG_compile_unit:
----------------
Michael137 wrote:

Ah looks like the early-return was removed in the refactor in https://github.com/llvm/llvm-project/pull/93291?
This LGTM but @labath had plans to align `GetTypeLookupContext` and `GetDeclContext`, so wanted him to have a look too

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


More information about the lldb-commits mailing list