]> granicus.if.org Git - clang/commitdiff
When performing layout for an Objective-C class, make sure to dig out
authorDouglas Gregor <dgregor@apple.com>
Tue, 20 Dec 2011 15:50:13 +0000 (15:50 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 20 Dec 2011 15:50:13 +0000 (15:50 +0000)
the definition of that class. Fixes PR11613 / <rdar://problem/10604077>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146976 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/RecordLayoutBuilder.cpp
test/CodeGenObjC/forward-class-impl-metadata.m

index a47bd4afb438bf909194a4220215b8d828f14c69..43dee104ba364c41ba87d1916a395be9c5cc6a9c 100644 (file)
@@ -2161,7 +2161,9 @@ const CXXMethodDecl *ASTContext::getKeyFunction(const CXXRecordDecl *RD) {
 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 =
index e9e08589d19f1e5b60d1e5ab96844f186cd4ca3d..371abf2ade9cd886d437dcb3c15d65cbf5435379 100644 (file)
@@ -39,3 +39,9 @@ int f0(A *a) {
 @implementation A
 @synthesize p0 = _p0;
 @end
+
+@interface B
+@end
+@class B;
+@implementation B
+@end