[Lldb-commits] [PATCH] D156774: [lldb] Parse enums while parsing a type

Vlad Serebrennikov via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 2 02:32:58 PDT 2023


Endill added inline comments.


================
Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp:3040
 
+    case DW_TAG_enumeration_type:
+    {
----------------
Michael137 wrote:
> Michael137 wrote:
> > Michael137 wrote:
> > > Michael137 wrote:
> > > > At first glance this seems OK but I'll want to check why the type doesn't get resolved when `clang::Sema` asks LLDB for it by name
> > > Checking locally and will report back
> > Ok, so what happens for `expr Outer::Enum::var` is that LLDB will first resolve the `Outer` structure (and all its member fields, but not nested types). When clang looks for `Enum`, it wants to find it in a direct lookup into the `Outer` DeclContext. But that lookup will fail because we never created the decls for the nested type. There is no fallback to the external source in such a case unfortunately so LLDB never has the chance to correct this. See the `LookupQualifiedName` code path in `Sema::BuildCXXNestedNameSpecifier`.
> > 
> > So I think this proposed approach should be fine. But what I think could be better is if we just do the same for `DW_TAG_enumeration_type` and `DW_TAG_structure_type` as we do for `DW_TAG_subprogram`.
> > 
> > I.e., simply push back the type into `member_function_dies` (we should rename this) and then it will get resolved properly in `CompleteRecordType`.
> Also `DW_TAG_union_type` while you're here :)
I can look into doing things more lazily like `DW_TAG_subprogram`, if you can point me to code paths for this on LLDB side:
> When clang looks for Enum, it wants to find it in a direct lookup into the Outer DeclContext. But that lookup will fail because we never created the decls for the nested type. There is no fallback to the external source in such a case unfortunately so LLDB never has the chance to correct this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D156774



More information about the lldb-commits mailing list