r201753 - [AST] Follow-up for r201468, move the check to the caller and add an assertion.

Argyrios Kyrtzidis akyrtzi at gmail.com
Wed Feb 19 20:00:02 PST 2014


Author: akirtzidis
Date: Wed Feb 19 22:00:01 2014
New Revision: 201753

URL: http://llvm.org/viewvc/llvm-project?rev=201753&view=rev
Log:
[AST] Follow-up for r201468, move the check to the caller and add an assertion.

Suggested by Richard Smith.

Modified:
    cfe/trunk/lib/AST/ExprConstant.cpp

Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=201753&r1=201752&r2=201753&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Wed Feb 19 22:00:01 2014
@@ -3117,14 +3117,18 @@ static bool EvaluateDecl(EvalInfo &Info,
     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, Ev
 /// 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;
 





More information about the cfe-commits mailing list