================ @@ -1671,43 +1671,84 @@ DWARFASTParserClang::ParseStructureLikeDIE(const SymbolContext &sc, attrs.is_forward_declaration = true; } + DWARFDIE def_die; + if (attrs.is_forward_declaration && cu_language == eLanguageTypeObjC) { + def_die = dwarf->FindDefinitionDIE(die); + + if (!def_die) { + SymbolFileDWARFDebugMap *debug_map_symfile = dwarf->GetDebugMapSymfile(); + if (debug_map_symfile) { + // We weren't able to find a full declaration in this DWARF, + // see if we have a declaration anywhere else... + def_die = debug_map_symfile->FindDefinitionDIE(die); + } + } + + if (log) { + dwarf->GetObjectFile()->GetModule()->LogMessage( + log, + "SymbolFileDWARF({0:p}) - {1:x16}}: {2} ({3}) type \"{4}\" is a " + "forward declaration, complete DIE is {5}", + static_cast<void *>(this), die.GetID(), DW_TAG_value_to_name(tag), + tag, attrs.name.GetCString(), + def_die ? llvm::utohexstr(def_die.GetID()) : "not found"); + } + + if (def_die) { + if (auto [it, inserted] = dwarf->GetDIEToType().try_emplace( + def_die.GetDIE(), DIE_IS_BEING_PARSED); + !inserted) { + if (it->getSecond() == nullptr || + it->getSecond() == DIE_IS_BEING_PARSED) + return nullptr; + return it->getSecond()->shared_from_this(); + } + attrs = ParsedDWARFTypeAttributes(def_die); + } + } + + if (!def_die) + def_die = die; + if (attrs.name) { - GetUniqueTypeNameAndDeclaration(die, cu_language, unique_typename, + GetUniqueTypeNameAndDeclaration(def_die, cu_language, unique_typename, ---------------- ZequanWu wrote:
+1, for non-objc/objc++ cases, the parameter die could be a def die or decl die. Maybe move def_die into the above block and update the parameter die to def_die if def_die is valid. https://github.com/llvm/llvm-project/pull/119860 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits