summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ExprConstant.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2014-02-20 04:00:01 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2014-02-20 04:00:01 +0000
commit3d9e38273b9bfaa35d8f55751989db90a149329b (patch)
tree722a2d532aaf983153935074ea6fbe3bf29eb8d9 /clang/lib/AST/ExprConstant.cpp
parent420569be0454a3fb254dc98202080a8ec904fd2a (diff)
downloadbcm5719-llvm-3d9e38273b9bfaa35d8f55751989db90a149329b.tar.gz
bcm5719-llvm-3d9e38273b9bfaa35d8f55751989db90a149329b.zip
[AST] Follow-up for r201468, move the check to the caller and add an assertion.
Suggested by Richard Smith. llvm-svn: 201753
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r--clang/lib/AST/ExprConstant.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index b11e9e8a272..e172c914785 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -3117,14 +3117,18 @@ static bool EvaluateDecl(EvalInfo &Info, const Decl *D) {
Result.set(VD, Info.CurrentCall->Index);
APValue &Val = Info.CurrentCall->createTemporary(VD, true);
- if (!VD->getInit()) {
+ const Expr *InitE = VD->getInit();
+ if (!InitE) {
Info.Diag(D->getLocStart(), diag::note_constexpr_uninitialized)
<< false << VD->getType();
Val = APValue();
return false;
}
- if (!EvaluateInPlace(Val, Info, Result, VD->getInit())) {
+ if (InitE->isValueDependent())
+ return false;
+
+ if (!EvaluateInPlace(Val, Info, Result, InitE)) {
// Wipe out any partially-computed value, to allow tracking that this
// evaluation failed.
Val = APValue();
@@ -8028,8 +8032,8 @@ static bool Evaluate(APValue &Result, EvalInfo &Info, const Expr *E) {
/// an object can indirectly refer to subobjects which were initialized earlier.
static bool EvaluateInPlace(APValue &Result, EvalInfo &Info, const LValue &This,
const Expr *E, bool AllowNonLiteralTypes) {
- if (E->isTypeDependent() || E->isValueDependent())
- return false;
+ assert(!E->isValueDependent());
+
if (!AllowNonLiteralTypes && !CheckLiteralType(Info, E, &This))
return false;
OpenPOWER on IntegriCloud