aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/ExprConstant.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-04-10 04:54:13 +0000
committerAnders Carlsson <andersca@mac.com>2009-04-10 04:54:13 +0000
commit1b78276a75a5a0f496a82429c1ff9604d622a76d (patch)
tree4aaf185a8be4d5d377f7af387a3b09decd5a58e1 /lib/AST/ExprConstant.cpp
parentf0930235ce58a91aa3b840bece9052f44d630536 (diff)
Add Expr::EvaluateAsLValue which will (believe it or not) try to evaluate an Expr as an LValue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68763 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ExprConstant.cpp')
-rw-r--r--lib/AST/ExprConstant.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp
index 643e066c7b..327fff0c0b 100644
--- a/lib/AST/ExprConstant.cpp
+++ b/lib/AST/ExprConstant.cpp
@@ -1651,6 +1651,12 @@ bool Expr::Evaluate(EvalResult &Result, ASTContext &Ctx) const {
return true;
}
+bool Expr::EvaluateAsLValue(EvalResult &Result, ASTContext &Ctx) const {
+ EvalInfo Info(Ctx, Result);
+
+ return EvaluateLValue(this, Result.Val, Info) && !Result.HasSideEffects;
+}
+
/// isEvaluatable - Call Evaluate to see if this expression can be constant
/// folded, but discard the result.
bool Expr::isEvaluatable(ASTContext &Ctx) const {