diff options
author | Anders Carlsson <andersca@mac.com> | 2009-04-10 04:54:13 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-04-10 04:54:13 +0000 |
commit | 43168129d05ed1942d6948f77b89f922cb7ab8d4 (patch) | |
tree | 09d46b3bf720fff52588c6d45d8a34fa6d8ca62a /clang/lib/AST/ExprConstant.cpp | |
parent | 0e6d2b3a708056b8d7b4328c73c7625a5dfe7b16 (diff) | |
download | bcm5719-llvm-43168129d05ed1942d6948f77b89f922cb7ab8d4.tar.gz bcm5719-llvm-43168129d05ed1942d6948f77b89f922cb7ab8d4.zip |
Add Expr::EvaluateAsLValue which will (believe it or not) try to evaluate an Expr as an LValue.
llvm-svn: 68763
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r-- | clang/lib/AST/ExprConstant.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 643e066c7b4..327fff0c0b1 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/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 { |