aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/ExprConstant.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2008-08-10 17:03:01 +0000
committerAnders Carlsson <andersca@mac.com>2008-08-10 17:03:01 +0000
commit165a70fd0b75a4f23456531824e1b76a9f1c4f9c (patch)
tree6086759e4a6d7c4d5e92a6b0c265fdef8d292016 /lib/AST/ExprConstant.cpp
parent613535273b90dc5cbd0f9fa056dedc93801ea35a (diff)
Remove the old evaluator code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54615 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ExprConstant.cpp')
-rw-r--r--lib/AST/ExprConstant.cpp42
1 files changed, 2 insertions, 40 deletions
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<ParenExpr>(Expr))
- return CalcFakeICEVal(PE->getSubExpr(), Result, Context);
-
- if (const CastExpr *CE = dyn_cast<CastExpr>(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;
}