summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExprConstant.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2010-07-17 23:55:01 +0000
committerEli Friedman <eli.friedman@gmail.com>2010-07-17 23:55:01 +0000
commit3ee1022f377ff98db758dcc9393057e9098989af (patch)
treea0899afef582c83fcccfd8569e2134bc637de1aa /clang/lib/CodeGen/CGExprConstant.cpp
parent2960987ddb8183fcf2935ffeec25b60976de38dc (diff)
downloadbcm5719-llvm-3ee1022f377ff98db758dcc9393057e9098989af.tar.gz
bcm5719-llvm-3ee1022f377ff98db758dcc9393057e9098989af.zip
Fix crash initializing a bit-field with a non-constant in a place where we
try to evaluate the initializer as a constant. llvm-svn: 108632
Diffstat (limited to 'clang/lib/CodeGen/CGExprConstant.cpp')
-rw-r--r--clang/lib/CodeGen/CGExprConstant.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp
index bbd256c4f1f..4831b5dabe0 100644
--- a/clang/lib/CodeGen/CGExprConstant.cpp
+++ b/clang/lib/CodeGen/CGExprConstant.cpp
@@ -81,10 +81,6 @@ AppendField(const FieldDecl *Field, uint64_t FieldOffset,
assert(NextFieldOffsetInBytes <= FieldOffsetInBytes
&& "Field offset mismatch!");
- // Emit the field.
- if (!InitCst)
- return false;
-
unsigned FieldAlignment = getAlignment(InitCst);
// Round up the field offset to the alignment of the field type.
@@ -360,6 +356,9 @@ bool ConstStructBuilder::Build(InitListExpr *ILE) {
Field->getType(), CGF);
else
EltInit = CGM.EmitNullConstant(Field->getType());
+
+ if (!EltInit)
+ return false;
if (!Field->isBitField()) {
// Handle non-bitfield members.
OpenPOWER on IntegriCloud