diff options
-rw-r--r-- | clang/lib/AST/RecordLayoutBuilder.cpp | 4 | ||||
-rw-r--r-- | clang/test/CodeGenObjC/forward-class-impl-metadata.m | 6 |
2 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/AST/RecordLayoutBuilder.cpp b/clang/lib/AST/RecordLayoutBuilder.cpp index a47bd4afb43..43dee104ba3 100644 --- a/clang/lib/AST/RecordLayoutBuilder.cpp +++ b/clang/lib/AST/RecordLayoutBuilder.cpp @@ -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 = diff --git a/clang/test/CodeGenObjC/forward-class-impl-metadata.m b/clang/test/CodeGenObjC/forward-class-impl-metadata.m index e9e08589d19..371abf2ade9 100644 --- a/clang/test/CodeGenObjC/forward-class-impl-metadata.m +++ b/clang/test/CodeGenObjC/forward-class-impl-metadata.m @@ -39,3 +39,9 @@ int f0(A *a) { @implementation A @synthesize p0 = _p0; @end + +@interface B +@end +@class B; +@implementation B +@end |