diff options
author | John McCall <rjmccall@apple.com> | 2011-10-07 02:39:22 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-10-07 02:39:22 +0000 |
commit | 0710e551efb70fab61e1afc8e7d7a7079b6810e0 (patch) | |
tree | 85cfeb1b1057a87593d2b02c7d52b2a0681b577b /clang/lib/AST/RecordLayoutBuilder.cpp | |
parent | 5f4c61e2d7ebbde6cb282d9693babbd8a71fd9f6 (diff) | |
download | bcm5719-llvm-0710e551efb70fab61e1afc8e7d7a7079b6810e0.tar.gz bcm5719-llvm-0710e551efb70fab61e1afc8e7d7a7079b6810e0.zip |
Record layout requires not just a definition, but a complete
definition. Assert this. Change IR generation to not try to
aggressively emit the IR translation of a record during its
own definition. Fixes PR10912.
llvm-svn: 141350
Diffstat (limited to 'clang/lib/AST/RecordLayoutBuilder.cpp')
-rw-r--r-- | clang/lib/AST/RecordLayoutBuilder.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/AST/RecordLayoutBuilder.cpp b/clang/lib/AST/RecordLayoutBuilder.cpp index 8e715887680..369ebec3ddf 100644 --- a/clang/lib/AST/RecordLayoutBuilder.cpp +++ b/clang/lib/AST/RecordLayoutBuilder.cpp @@ -2007,8 +2007,13 @@ RecordLayoutBuilder::Diag(SourceLocation Loc, unsigned DiagID) { /// position information. const ASTRecordLayout & ASTContext::getASTRecordLayout(const RecordDecl *D) const { + // These asserts test different things. A record has a definition + // 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. D = D->getDefinition(); assert(D && "Cannot get layout of forward declarations!"); + assert(D->isDefinition() && "Cannot layout type before complete!"); // Look up this layout, if already laid out, return what we have. // Note that we can't save a reference to the entry because this function |