aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2012-02-08 00:04:52 +0000
committerSean Callanan <scallanan@apple.com>2012-02-08 00:04:52 +0000
commitfd5a5f547c5012197475ba628947d9755c96cfdc (patch)
tree78c3c58fa0347a76ca31cf4c438b776d01a50bcc
parentda35eacc6e05a99ab30f7290f1d42df32d06b22e (diff)
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
-rw-r--r--lib/AST/RecordLayoutBuilder.cpp4
1 files changed, 4 insertions, 0 deletions
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<RecordDecl*>(D));
+
D = D->getDefinition();
assert(D && "Cannot get layout of forward declarations!");
assert(D->isCompleteDefinition() && "Cannot layout type before complete!");