[lldb][DWARFASTParserClang] Eagerly search definitions for Objective-C classes #9749
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch essentially reverts the definition DIE delay changes (in llvm#98361) for Objective-C.
The problem we've been seeing is as follows:
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
ObjCMethodDecl
for it (and attach it to the context).When parsing the subprogram DIE, we first try to complete the DeclContext. Because
ExtendedClass
is 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::ParseObjCMethod
because it expects the context to be anclang::ObjCObjectOrInterfaceType
. So it bails and we end up crashing because we try to attach aFunctionDecl
to 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.