[cfe-commits] r146976 - in /cfe/trunk: lib/AST/RecordLayoutBuilder.cpp test/CodeGenObjC/forward-class-impl-metadata.m

Douglas Gregor dgregor at apple.com
Tue Dec 20 07:50:13 PST 2011


Author: dgregor
Date: Tue Dec 20 09:50:13 2011
New Revision: 146976

URL: http://llvm.org/viewvc/llvm-project?rev=146976&view=rev
Log:
When performing layout for an Objective-C class, make sure to dig out
the definition of that class. Fixes PR11613 / <rdar://problem/10604077>.

Modified:
    cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
    cfe/trunk/test/CodeGenObjC/forward-class-impl-metadata.m

Modified: cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayoutBuilder.cpp?rev=146976&r1=146975&r2=146976&view=diff
==============================================================================
--- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp Tue Dec 20 09:50:13 2011
@@ -2161,7 +2161,9 @@
 const ASTRecordLayout &
 ASTContext::getObjCLayout(const ObjCInterfaceDecl *D,
                           const ObjCImplementationDecl *Impl) const {
-  assert(D->isThisDeclarationADefinition() && "Invalid interface decl!");
+  // Retrieve the definition
+  D = D->getDefinition();
+  assert(D && D->isThisDeclarationADefinition() && "Invalid interface decl!");
 
   // Look up this layout, if already laid out, return what we have.
   ObjCContainerDecl *Key =

Modified: cfe/trunk/test/CodeGenObjC/forward-class-impl-metadata.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/forward-class-impl-metadata.m?rev=146976&r1=146975&r2=146976&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/forward-class-impl-metadata.m (original)
+++ cfe/trunk/test/CodeGenObjC/forward-class-impl-metadata.m Tue Dec 20 09:50:13 2011
@@ -39,3 +39,9 @@
 @implementation A
 @synthesize p0 = _p0;
 @end
+
+ at interface B
+ at end
+ at class B;
+ at implementation B
+ at end





More information about the cfe-commits mailing list