================
@@ -1654,6 +1660,99 @@ bool SymbolFileDWARF::CompleteType(CompilerType
&compiler_type) {
return false;
}
+DWARFDIE SymbolFileDWARF::FindDefinitionDIE(const DWARFDIE &die) {
+ auto def_die_it = GetDeclarationDIEToDefinitionDIE().find(die.GetDIE());
+ if (def_die_it != GetDeclarationDIEToDefinitionDIE().end())
+ return GetDIE(def_die_it->getSecond());
+
+ ParsedDWARFTypeAttributes attrs(die);
+ const dw_tag_t tag = die.Tag();
+ TypeSP type_sp;
+ Log *log = GetLog(DWARFLog::TypeCompletion | DWARFLog::Lookups);
+ if (log) {
+ GetObjectFile()->GetModule()->LogMessage(
+ log,
+ "SymbolFileDWARF({0:p}) - {1:x16}: {2} type \"{3}\" is a "
+ "forward declaration DIE, trying to find definition DIE",
+ static_cast<void *>(this), die.GetOffset(), DW_TAG_value_to_name(tag),
+ attrs.name.GetCString());
+ }
+ // We haven't parse definition die for this type, starting to search for it.
+ // After we found the definition die, the GetDeclarationDIEToDefinitionDIE()
+ // map will have the new mapping from this declaration die to definition die.
+ if (attrs.class_language == eLanguageTypeObjC ||
----------------
labath wrote:
Definitely anything that is gated on `language == eLanguageType*C*` checks, but
a case could also be made that the whole declaration-to-definition mapping
should be within the purview of the DWARFASTParser instance responsible for the
specific language. Having the logic split between an ASTParser (a
language-specific class) and SymbolFileDWARF (language-agnostic) forces all
languages to work in the same way. I don't know how much of a problem would
that be in practice, but it would definitely make the code nicer (single
responsibility principle, and all) if the logic lived in a central place.
https://github.com/llvm/llvm-project/pull/90663
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits