summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/RecordLayoutBuilder.cpp
diff options
context:
space:
mode:
authorMatt Beaumont-Gay <matthewbg@google.com>2013-06-25 22:19:15 +0000
committerMatt Beaumont-Gay <matthewbg@google.com>2013-06-25 22:19:15 +0000
commit35779955b3b845f0d72d0b63bda482c5f64f21f0 (patch)
treeaa72271aeab9021b0db8e7eddc30a344a893a4ca /clang/lib/AST/RecordLayoutBuilder.cpp
parentba8f17ac1037d1c554f906801e0d1fa6b009f22c (diff)
downloadbcm5719-llvm-35779955b3b845f0d72d0b63bda482c5f64f21f0.tar.gz
bcm5719-llvm-35779955b3b845f0d72d0b63bda482c5f64f21f0.zip
Don't try to get the layout of an invalid decl in getDeclAlign.
When the decl that we're getting alignment for is a FieldDecl, and the field's parent record is invalid, skip the actual field alignment calculation (and return 1-byte alignment in the general case). Also, assert in in getASTRecordLayout that the decl is valid. This was inspired by PR16292; see also r184581 and r184751. llvm-svn: 184883
Diffstat (limited to 'clang/lib/AST/RecordLayoutBuilder.cpp')
-rw-r--r--clang/lib/AST/RecordLayoutBuilder.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/clang/lib/AST/RecordLayoutBuilder.cpp b/clang/lib/AST/RecordLayoutBuilder.cpp
index 4cd05b7f60f..c4ee565c8ad 100644
--- a/clang/lib/AST/RecordLayoutBuilder.cpp
+++ b/clang/lib/AST/RecordLayoutBuilder.cpp
@@ -2468,6 +2468,7 @@ ASTContext::getASTRecordLayout(const RecordDecl *D) const {
D = D->getDefinition();
assert(D && "Cannot get layout of forward declarations!");
+ assert(!D->isInvalidDecl() && "Cannot get layout of invalid decl!");
assert(D->isCompleteDefinition() && "Cannot layout type before complete!");
// Look up this layout, if already laid out, return what we have.
OpenPOWER on IntegriCloud