From: Anders Carlsson Date: Sun, 10 Aug 2008 17:03:01 +0000 (+0000) Subject: Remove the old evaluator code. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=165a70fd0b75a4f23456531824e1b76a9f1c4f9c;p=clang Remove the old evaluator code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54615 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index e516beb0ac..62e1441484 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -21,37 +21,6 @@ using namespace clang; using llvm::APSInt; -#define USE_NEW_EVALUATOR 1 - -static bool CalcFakeICEVal(const Expr *Expr, - llvm::APSInt &Result, - ASTContext &Context) { - // Calculate the value of an expression that has a calculatable - // value, but isn't an ICE. Currently, this only supports - // a very narrow set of extensions, but it can be expanded if needed. - if (const ParenExpr *PE = dyn_cast(Expr)) - return CalcFakeICEVal(PE->getSubExpr(), Result, Context); - - if (const CastExpr *CE = dyn_cast(Expr)) { - QualType CETy = CE->getType(); - if ((CETy->isIntegralType() && !CETy->isBooleanType()) || - CETy->isPointerType()) { - if (CalcFakeICEVal(CE->getSubExpr(), Result, Context)) { - Result.extOrTrunc(Context.getTypeSize(CETy)); - // FIXME: This assumes pointers are signed. - Result.setIsSigned(CETy->isSignedIntegerType() || - CETy->isPointerType()); - return true; - } - } - } - - if (Expr->getType()->isIntegralType()) - return Expr->isIntegerConstantExpr(Result, Context); - - return false; -} - /// EvalInfo - This is a private struct used by the evaluator to capture /// information about a subexpression as it is folded. It retains information /// about the AST context, but also maintains information about the folded @@ -552,7 +521,7 @@ bool IntExprEvaluator::HandleCast(SourceLocation CastLoc, bool Expr::tryEvaluate(APValue &Result, ASTContext &Ctx) const { llvm::APSInt sInt(32); -#if USE_NEW_EVALUATOR + EvalInfo Info(Ctx); if (getType()->isIntegerType()) { if (EvaluateInteger(this, sInt, Info)) { @@ -561,13 +530,6 @@ bool Expr::tryEvaluate(APValue &Result, ASTContext &Ctx) const { } } else return false; - -#else - if (CalcFakeICEVal(this, sInt, Ctx)) { - Result = APValue(sInt); - return true; - } -#endif - + return false; }