diff options
author | Steve Naroff <snaroff@apple.com> | 2008-12-17 14:13:49 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2008-12-17 14:13:49 +0000 |
commit | 7d1117d93cb6cc57db6157478f02ebc0f0a1060c (patch) | |
tree | d5e5b8caaef64f78efb4d8cfc7920b38d8f5d9d0 | |
parent | 777f07b6cd595bb0922e05768e5703fbc92b5695 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61134 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/AST/DeclObjC.cpp | 2 | ||||
-rw-r--r-- | test/SemaObjC/interface-layout-2.m | 16 |
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp index 9e803b71e1..12c224501c 100644 --- a/lib/AST/DeclObjC.cpp +++ b/lib/AST/DeclObjC.cpp @@ -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); diff --git a/test/SemaObjC/interface-layout-2.m b/test/SemaObjC/interface-layout-2.m new file mode 100644 index 0000000000..50dd2f9545 --- /dev/null +++ b/test/SemaObjC/interface-layout-2.m @@ -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 |