]> granicus.if.org Git - clang/commitdiff
rename Expr::tryEvaluate to Expr::Evaluate.
authorChris Lattner <sabre@nondot.org>
Sun, 16 Nov 2008 21:24:15 +0000 (21:24 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 16 Nov 2008 21:24:15 +0000 (21:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59426 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 5255f18445e8b32217f7db794067b95c472a8cb3..6e67f2853f939c6cc17f1fd00be3306d14bf98f3 100644 (file)
@@ -134,13 +134,13 @@ public:
   /// 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;
 
index 871dc4bb77a7e245c75ca7202d77e100dc972b61..29d9a11de785287cde886e09008d70affb1432e9 100644 (file)
@@ -798,7 +798,7 @@ bool Expr::isIntegerConstantExpr(llvm::APSInt &Result, ASTContext &Ctx,
     // 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.
       }
index 86f7a2181e0e08a02e979ecc4fb88c4d3c4e3248..625a414aa9d65ba3cc1a45ca76378d6e8daa6804 100644 (file)
@@ -508,7 +508,7 @@ bool IntExprEvaluator::VisitCallExpr(const CallExpr *E) {
     // __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 @@ static bool EvaluateComplexFloat(const Expr *E, APValue &Result, EvalInfo &Info)
 }
 
 //===----------------------------------------------------------------------===//
-// 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 @@ bool Expr::tryEvaluate(APValue &Result, ASTContext &Ctx) const {
   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);
 }
index 98e70e892d38b2e5dffed0d7f0df43213a8c518e..a8eb8f794b7052dc09c72b5852917d32d209b8e0 100644 (file)
@@ -39,7 +39,7 @@ static RValue EmitBinaryAtomic(CodeGenFunction& CFG,
 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");
index 7b33fdbe8ecbdea8e363d1a6b3941cead4fc2464..41379b5b4a4ff1614abd2ab998fa1d366a656357 100644 (file)
@@ -610,7 +610,7 @@ public:
 
   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 @@ llvm::Constant *CodeGenModule::EmitConstantExpr(const Expr *E,
 
 #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!");
index e6deaa7475bcceb092277af69435d5d6d9eedc95..ff05f6e5855a782bac3e780aaff2d8d138a9688a 100644 (file)
@@ -197,7 +197,7 @@ int CodeGenFunction::ConstantFoldsToSimpleInteger(const Expr *Cond) {
   
   // 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))
index dd76e15c09bb3ef5e80f3aab7b906dacc0696f63..1ecaaa370a4ea1682819877f5b43b0b0904c5679 100644 (file)
@@ -1560,11 +1560,11 @@ bool Sema::CheckArithmeticConstantExpression(const Expr* Init) {
     // 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 @@ static QualType TryToFixInvalidVariablyModifiedType(QualType T,
   
   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!");