summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/RecordLayoutBuilder.cpp
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
commit56c198962cfb9da40769b043d07d2b902e852fe3 (patch)
tree56224ba2320efd0341149e58b4720ee7de26ab8b /clang/lib/AST/RecordLayoutBuilder.cpp
parentded4c99f2e0561fcebbdc7736472ba8c2b8ce463 (diff)
downloadbcm5719-llvm-56c198962cfb9da40769b043d07d2b902e852fe3.tar.gz
bcm5719-llvm-56c198962cfb9da40769b043d07d2b902e852fe3.zip
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. llvm-svn: 150020
Diffstat (limited to 'clang/lib/AST/RecordLayoutBuilder.cpp')
-rw-r--r--clang/lib/AST/RecordLayoutBuilder.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/AST/RecordLayoutBuilder.cpp b/clang/lib/AST/RecordLayoutBuilder.cpp
index fb99170d5b5..7c4f7f2622e 100644
--- a/clang/lib/AST/RecordLayoutBuilder.cpp
+++ b/clang/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!");
OpenPOWER on IntegriCloud