From: Sean Callanan Date: Wed, 8 Feb 2012 00:04:52 +0000 (+0000) Subject: If a struct needs to be laid out, and it has not X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fd5a5f547c5012197475ba628947d9755c96cfdc;p=clang If a struct needs to be laid out, and it has not been completed yet, then complete it if possible. This fixes some assertion failures encountered by LLDB. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150020 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/RecordLayoutBuilder.cpp b/lib/AST/RecordLayoutBuilder.cpp index fb99170d5b..7c4f7f2622 100644 --- a/lib/AST/RecordLayoutBuilder.cpp +++ b/lib/AST/RecordLayoutBuilder.cpp @@ -2187,6 +2187,10 @@ ASTContext::getASTRecordLayout(const RecordDecl *D) const { // as soon as we begin to parse the definition. That definition is // not a complete definition (which is what isDefinition() tests) // until we *finish* parsing the definition. + + if (D->hasExternalLexicalStorage() && !D->getDefinition()) + getExternalSource()->CompleteType(const_cast(D)); + D = D->getDefinition(); assert(D && "Cannot get layout of forward declarations!"); assert(D->isCompleteDefinition() && "Cannot layout type before complete!");