[Lldb-commits] [lldb] [WIP][lldb][DWARFASTParserClang] Eagerly search definitions for Objective-C classes (PR #119860)
Adrian Prantl via lldb-commits
lldb-commits at lists.llvm.org
Fri Dec 13 10:00:01 PST 2024
================
@@ -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,
----------------
adrian-prantl wrote:
I find the name def_die misleading here. IIUC, it *may* be a def die if the block above was run and successful?
https://github.com/llvm/llvm-project/pull/119860
More information about the lldb-commits
mailing list