diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-12-28 19:48:30 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-12-28 19:48:30 +0000 |
commit | 5fab0c9e1ad172c0db6cc9f3169666e49b7864b6 (patch) | |
tree | a5682a764875540c534db1a6460792d4a599c6a3 /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | e4a84c4f1f17a1e9b7f0e9a75f9d8ee1824feb33 (diff) | |
download | bcm5719-llvm-5fab0c9e1ad172c0db6cc9f3169666e49b7864b6.tar.gz bcm5719-llvm-5fab0c9e1ad172c0db6cc9f3169666e49b7864b6.zip |
Small refactoring and simplification of constant evaluation and some of its
clients. No functionality change.
llvm-svn: 147318
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 0a5efe03be7..62d18ea8eed 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -18,7 +18,6 @@ #include "CGDebugInfo.h" #include "CGException.h" #include "clang/Basic/TargetInfo.h" -#include "clang/AST/APValue.h" #include "clang/AST/ASTContext.h" #include "clang/AST/Decl.h" #include "clang/AST/DeclCXX.h" @@ -520,15 +519,14 @@ bool CodeGenFunction:: ConstantFoldsToSimpleInteger(const Expr *Cond, llvm::APInt &ResultInt) { // FIXME: Rename and handle conversion of other evaluatable things // to bool. - Expr::EvalResult Result; - if (!Cond->EvaluateAsRValue(Result, getContext()) || !Result.Val.isInt() || - Result.HasSideEffects) + llvm::APSInt Int; + if (!Cond->EvaluateAsInt(Int, getContext())) return false; // Not foldable, not integer or not fully evaluatable. - + if (CodeGenFunction::ContainsLabel(Cond)) return false; // Contains a label. - - ResultInt = Result.Val.getInt(); + + ResultInt = Int; return true; } |