[lldb][DWARFASTParserClang] Eagerly search definitions for Objective-C classes
This patch essentially reverts the definition DIE delay changes (in https://github.com/llvm/llvm-project/pull/98361) for Objective-C.
The problem we've been seeing is as follows:
- An Objetive-C class extension is represented in DWARF as:
DW_TAG_structure_type
DW_AT_declaration (true)
DW_AT_name ("ExtendedClass")
DW_TAG_subprogram
DW_AT_name ("extensionMethod")
...
I.e., it is a forward declaration of the extended class, but that forward declaration has children methods.
-
When we set a breakpoint in one of those methods we parse the subprogram DIE and try to create an
ObjCMethodDeclfor it (and attach it to the context). -
When parsing the subprogram DIE, we first try to complete the DeclContext. Because
ExtendedClassis only a forward declaration and we don't try to fetch the definition DIE eagerly anymore, LLDB has no idea that we're dealing with an Objective-C type. So it goes ahead and constructs it as aCXXRecordDecl. This confusesDWARFASTParserClang::ParseObjCMethodbecause it expects the context to be anclang::ObjCObjectOrInterfaceType. So it bails and we end up crashing because we try to attach aFunctionDeclto an incompleteCXXRecordDecl(which wasn't even forcefully completed).
Since there's no good way to tell whether a forward declaration is an Objective-C type, the only solution I can really see here is to eagerly fetch the definition for Objective-C types.
@swift-ci test
@swift-ci test
Not needed, for now..