[cfe-commits] r61134 - in /cfe/trunk: lib/AST/DeclObjC.cpp test/SemaObjC/interface-layout-2.m
Steve Naroff
snaroff at apple.com
Wed Dec 17 06:14:06 PST 2008
Author: snaroff
Date: Wed Dec 17 08:13:49 2008
New Revision: 61134
URL: http://llvm.org/viewvc/llvm-project?rev=61134&view=rev
Log:
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.
Added:
cfe/trunk/test/SemaObjC/interface-layout-2.m
Modified:
cfe/trunk/lib/AST/DeclObjC.cpp
Modified: cfe/trunk/lib/AST/DeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=61134&r1=61133&r2=61134&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Wed Dec 17 08:13:49 2008
@@ -369,6 +369,8 @@
///
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);
Added: cfe/trunk/test/SemaObjC/interface-layout-2.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/interface-layout-2.m?rev=61134&view=auto
==============================================================================
--- cfe/trunk/test/SemaObjC/interface-layout-2.m (added)
+++ cfe/trunk/test/SemaObjC/interface-layout-2.m Wed Dec 17 08:13:49 2008
@@ -0,0 +1,16 @@
+// RUN: clang %s -fsyntax-only -verify
+ at interface A
+{
+ int ivar;
+}
+ at end
+
+ at interface B : A
+- (int)ivar;
+ at end
+
+ at implementation B
+- (int)ivar {
+ return ivar;
+}
+ at end
More information about the cfe-commits
mailing list