Fix <rdar://problem/6450964> clang on xcode: Assertion failed: (RecordForDecl && "lookupFieldDeclForIvar no storage for class").

This was a recent regression caused by r61043 (related to code gen. for ivar references).

Fariborz, please review. I have some other concerns related to code generation for ivars that we can discuss later.

llvm-svn: 61134
This commit is contained in:
Steve Naroff 2008-12-17 14:13:49 +00:00
parent 015a7f57b2
commit 596e137c84
2 changed files with 18 additions and 0 deletions

View File

@ -369,6 +369,8 @@ void ObjCInterfaceDecl::addInstanceVariablesToClass(ObjCIvarDecl **ivars,
///
FieldDecl *ObjCInterfaceDecl::lookupFieldDeclForIvar(ASTContext &Context,
const ObjCIvarDecl *ivar) {
if (!RecordForDecl)
addRecordToClass(Context);
assert(RecordForDecl && "lookupFieldDeclForIvar no storage for class");
DeclarationName Member = ivar->getDeclName();
DeclContext::lookup_result Lookup = RecordForDecl->lookup(Context, Member);

View File

@ -0,0 +1,16 @@
// RUN: clang %s -fsyntax-only -verify
@interface A
{
int ivar;
}
@end
@interface B : A
- (int)ivar;
@end
@implementation B
- (int)ivar {
return ivar;
}
@end