objective-c: Use class definition AST in several situations when

building related objc ASTs which require a class definition AST.
These were uncovered when testing objc rewriter.

llvm-svn: 147210
This commit is contained in:
Fariborz Jahanian 2011-12-23 00:31:02 +00:00
parent 8570abdc56
commit 87b4ae6cab
3 changed files with 20 additions and 1 deletions

View File

@ -814,7 +814,9 @@ public:
}
void setSuperClass(ObjCInterfaceDecl * superCls) {
data().SuperClass = superCls;
data().SuperClass =
(superCls && superCls->hasDefinition()) ? superCls->getDefinition()
: superCls;
}
ObjCCategoryDecl* getCategoryList() const {

View File

@ -1112,6 +1112,8 @@ ObjCCategoryImplDecl::Create(ASTContext &C, DeclContext *DC,
SourceLocation nameLoc,
SourceLocation atStartLoc,
SourceLocation CategoryNameLoc) {
if (ClassInterface && ClassInterface->hasDefinition())
ClassInterface = ClassInterface->getDefinition();
return new (C) ObjCCategoryImplDecl(DC, Id, ClassInterface,
nameLoc, atStartLoc, CategoryNameLoc);
}
@ -1196,6 +1198,8 @@ ObjCImplementationDecl::Create(ASTContext &C, DeclContext *DC,
ObjCInterfaceDecl *SuperDecl,
SourceLocation nameLoc,
SourceLocation atStartLoc) {
if (ClassInterface && ClassInterface->hasDefinition())
ClassInterface = ClassInterface->getDefinition();
return new (C) ObjCImplementationDecl(DC, ClassInterface, SuperDecl,
nameLoc, atStartLoc);
}

View File

@ -36,3 +36,16 @@ void *sel_registerName(const char *);
return [super allocWithZone:zone];
}
@end
@interface XNSArray
{
Class isa;
}
@end
@class XNSArray;
@interface __NSArray0 : XNSArray
@end
@implementation __NSArray0 @end