Move the definition-specific data of ObjCInterfaceDecl into a
separately-allocated DefinitionData structure, which we manage the same way as CXXRecordDecl::DefinitionData. This prepares the way for making ObjCInterfaceDecls redeclarable, to more accurately model forward declarations of Objective-C classes and eliminate the mutation of ObjCInterfaceDecl that causes us serious trouble in the AST reader. Note that ObjCInterfaceDecl's accessors are fairly robust against being applied to forward declarations, because Clang (and Sema in particular) doesn't perform RequireCompleteType/hasDefinition() checks everywhere it has to. Each of these overly-robust cases is marked with a FIXME, which we can tackle over time. llvm-svn: 146644
This commit is contained in:
@@ -4558,7 +4558,7 @@ static void AddObjCMethods(ObjCContainerDecl *Container,
|
||||
}
|
||||
|
||||
ObjCInterfaceDecl *IFace = dyn_cast<ObjCInterfaceDecl>(Container);
|
||||
if (!IFace)
|
||||
if (!IFace || !IFace->hasDefinition())
|
||||
return;
|
||||
|
||||
// Add methods in protocols.
|
||||
@@ -5783,6 +5783,9 @@ static void FindImplementableMethods(ASTContext &Context,
|
||||
bool InOriginalClass = true) {
|
||||
if (ObjCInterfaceDecl *IFace = dyn_cast<ObjCInterfaceDecl>(Container)) {
|
||||
// Recurse into protocols.
|
||||
if (!IFace->hasDefinition())
|
||||
return;
|
||||
|
||||
const ObjCList<ObjCProtocolDecl> &Protocols
|
||||
= IFace->getReferencedProtocols();
|
||||
for (ObjCList<ObjCProtocolDecl>::iterator I = Protocols.begin(),
|
||||
|
||||
Reference in New Issue
Block a user