aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/ExprConstant.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-10-06 06:49:02 +0000
committerChris Lattner <sabre@nondot.org>2008-10-06 06:49:02 +0000
commit45b6b9d080ac56917337d73d8f1cd6374b27b05d (patch)
tree864fcba0f3de84e80f75f96e295b220bb0366346 /lib/AST/ExprConstant.cpp
parenta4d55d89c8076b402bb168e3edeef0c2cd2a78c3 (diff)
Add a Expr::isEvaluatable method, eliminate isBuiltinConstantExpr
which is checking for something that can be inconsistent with what we can constant fold. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57159 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ExprConstant.cpp')
-rw-r--r--lib/AST/ExprConstant.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp
index 1506f448aa..af30ceb96c 100644
--- a/lib/AST/ExprConstant.cpp
+++ b/lib/AST/ExprConstant.cpp
@@ -693,3 +693,10 @@ bool Expr::tryEvaluate(APValue &Result, ASTContext &Ctx) const {
return false;
}
+
+/// isEvaluatable - Call tryEvaluate 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);
+}