]> granicus.if.org Git - clang/commitdiff
If a struct needs to be laid out, and it has not
authorSean Callanan <scallanan@apple.com>
Wed, 8 Feb 2012 00:04:52 +0000 (00:04 +0000)
committerSean Callanan <scallanan@apple.com>
Wed, 8 Feb 2012 00:04:52 +0000 (00:04 +0000)
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

lib/AST/RecordLayoutBuilder.cpp

index fb99170d5b52eb467d2330d84fb9bda9db7cd518..7c4f7f2622e521a5b7d051c6cbf9b26826b134d0 100644 (file)
@@ -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<RecordDecl*>(D));
+    
   D = D->getDefinition();
   assert(D && "Cannot get layout of forward declarations!");
   assert(D->isCompleteDefinition() && "Cannot layout type before complete!");