[cfe-commits] r59426 - in /cfe/trunk: include/clang/AST/Expr.h lib/AST/Expr.cpp lib/AST/ExprConstant.cpp lib/CodeGen/CGBuiltin.cpp lib/CodeGen/CGExprConstant.cpp lib/CodeGen/CodeGenFunction.cpp lib/Sema/SemaDecl.cpp
Chris Lattner
sabre at nondot.org
Sun Nov 16 13:24:18 PST 2008
Author: lattner
Date: Sun Nov 16 15:24:15 2008
New Revision: 59426
URL: http://llvm.org/viewvc/llvm-project?rev=59426&view=rev
Log:
rename Expr::tryEvaluate to Expr::Evaluate.
Modified:
cfe/trunk/include/clang/AST/Expr.h
cfe/trunk/lib/AST/Expr.cpp
cfe/trunk/lib/AST/ExprConstant.cpp
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/CodeGen/CGExprConstant.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
Modified: cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=59426&r1=59425&r2=59426&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Sun Nov 16 15:24:15 2008
@@ -134,13 +134,13 @@
/// isConstantExpr - Return true if this expression is a valid constant expr.
bool isConstantExpr(ASTContext &Ctx, SourceLocation *Loc) const;
- /// tryEvaluate - Return true if this is a constant which we can fold using
+ /// Evaluate - Return true if this is a constant which we can fold using
/// any crazy technique (that has nothing to do with language standards) that
/// we want to. If this function returns true, it returns the folded constant
/// in Result.
- bool tryEvaluate(APValue& Result, ASTContext &Ctx) const;
+ bool Evaluate(APValue& Result, ASTContext &Ctx) const;
- /// isEvaluatable - Call tryEvaluate to see if this expression can be constant
+ /// isEvaluatable - Call Evaluate to see if this expression can be constant
/// folded, but discard the result.
bool isEvaluatable(ASTContext &Ctx) const;
Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=59426&r1=59425&r2=59426&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Sun Nov 16 15:24:15 2008
@@ -798,7 +798,7 @@
// reject it.
if (CE->isBuiltinCall()) {
APValue ResultAP;
- if (CE->tryEvaluate(ResultAP, Ctx)) {
+ if (CE->Evaluate(ResultAP, Ctx)) {
Result = ResultAP.getInt();
break; // It is a constant, expand it.
}
Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=59426&r1=59425&r2=59426&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Sun Nov 16 15:24:15 2008
@@ -508,7 +508,7 @@
// __builtin_constant_p always has one operand: it returns true if that
// operand can be folded, false otherwise.
APValue Res;
- Result = E->getArg(0)->tryEvaluate(Res, Info.Ctx);
+ Result = E->getArg(0)->Evaluate(Res, Info.Ctx);
return true;
}
}
@@ -1094,14 +1094,14 @@
}
//===----------------------------------------------------------------------===//
-// Top level TryEvaluate.
+// Top level Expr::Evaluate method.
//===----------------------------------------------------------------------===//
-/// tryEvaluate - Return true if this is a constant which we can fold using
+/// Evaluate - Return true if this is a constant which we can fold using
/// any crazy technique (that has nothing to do with language standards) that
/// we want to. If this function returns true, it returns the folded constant
/// in Result.
-bool Expr::tryEvaluate(APValue &Result, ASTContext &Ctx) const {
+bool Expr::Evaluate(APValue &Result, ASTContext &Ctx) const {
EvalInfo Info(Ctx);
if (getType()->isIntegerType()) {
llvm::APSInt sInt(32);
@@ -1127,9 +1127,9 @@
return false;
}
-/// isEvaluatable - Call tryEvaluate to see if this expression can be constant
+/// isEvaluatable - Call Evaluate to see if this expression can be constant
/// folded, but discard the result.
bool Expr::isEvaluatable(ASTContext &Ctx) const {
APValue V;
- return tryEvaluate(V, Ctx);
+ return Evaluate(V, Ctx);
}
Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=59426&r1=59425&r2=59426&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Sun Nov 16 15:24:15 2008
@@ -39,7 +39,7 @@
RValue CodeGenFunction::EmitBuiltinExpr(unsigned BuiltinID, const CallExpr *E) {
// See if we can constant fold this builtin. If so, don't emit it at all.
APValue Result;
- if (E->tryEvaluate(Result, CGM.getContext())) {
+ if (E->Evaluate(Result, CGM.getContext())) {
if (Result.isInt())
return RValue::get(llvm::ConstantInt::get(Result.getInt()));
assert(Result.isFloat() && "Unsupported constant type");
Modified: cfe/trunk/lib/CodeGen/CGExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprConstant.cpp?rev=59426&r1=59425&r2=59426&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprConstant.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprConstant.cpp Sun Nov 16 15:24:15 2008
@@ -610,7 +610,7 @@
llvm::Constant *VisitCallExpr(const CallExpr *E) {
APValue Result;
- if (E->tryEvaluate(Result, CGM.getContext())) {
+ if (E->Evaluate(Result, CGM.getContext())) {
if (Result.isInt())
return llvm::ConstantInt::get(Result.getInt());
if (Result.isFloat())
@@ -845,7 +845,7 @@
#ifdef USE_TRY_EVALUATE
APValue V;
- if (E->tryEvaluate(V, Context)) {
+ if (E->Evaluate(V, Context)) {
// FIXME: Assert that the value doesn't have any side effects.
switch (V.getKind()) {
default: assert(0 && "unhandled value kind!");
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=59426&r1=59425&r2=59426&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Sun Nov 16 15:24:15 2008
@@ -197,7 +197,7 @@
// FIXME: Rename and handle conversion of other evaluatable things
// to bool.
- if (!Cond->tryEvaluate(V, getContext()) || !V.isInt())
+ if (!Cond->Evaluate(V, getContext()) || !V.isInt())
return 0; // Not foldable or not integer.
if (CodeGenFunction::ContainsLabel(Cond))
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=59426&r1=59425&r2=59426&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Sun Nov 16 15:24:15 2008
@@ -1560,11 +1560,11 @@
// specified arm of the conditional to be a constant. This is a horrible
// hack, but is require by real world code that uses __builtin_constant_p.
APValue Val;
- if (!Exp->getCond()->tryEvaluate(Val, Context)) {
- // If the tryEvaluate couldn't fold it, CheckArithmeticConstantExpression
+ if (!Exp->getCond()->Evaluate(Val, Context)) {
+ // If Evaluate couldn't fold it, CheckArithmeticConstantExpression
// won't be able to either. Use it to emit the diagnostic though.
bool Res = CheckArithmeticConstantExpression(Exp->getCond());
- assert(Res && "tryEvaluate couldn't evaluate this constant?");
+ assert(Res && "Evaluate couldn't evaluate this constant?");
return Res;
}
@@ -2494,7 +2494,7 @@
APValue Result;
if (!VLATy->getSizeExpr() ||
- !VLATy->getSizeExpr()->tryEvaluate(Result, Context))
+ !VLATy->getSizeExpr()->Evaluate(Result, Context))
return QualType();
assert(Result.isInt() && "Size expressions must be integers!");
More information about the cfe-commits
mailing list