diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-10-16 23:01:09 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-10-16 23:01:09 +0000 |
commit | 909c5553afb68743cf793dd7d5d82bdf5fa0bba7 (patch) | |
tree | 5390bf6c069030fda67c13972ae4c2bdd0540f9f /lib/Sema/SemaExpr.cpp | |
parent | 4c3fd511a6a83a0d729a40d659f1fa6bedbebd07 (diff) |
Slightly simplify a constant expression check. No functional change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142167 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 0a0009e602..83002d5695 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -6802,10 +6802,10 @@ inline QualType Sema::CheckLogicalOperands( // C99 6.5.[13,14] // that isn't 0 or 1 (which indicate a potential logical operation that // happened to fold to true/false) then warn. // Parens on the RHS are ignored. - Expr::EvalResult Result; - if (RHS.get()->Evaluate(Result, Context) && !Result.HasSideEffects) + llvm::APSInt Result; + if (RHS.get()->EvaluateAsInt(Result, Context)) if ((getLangOptions().Bool && !RHS.get()->getType()->isBooleanType()) || - (Result.Val.getInt() != 0 && Result.Val.getInt() != 1)) { + (Result != 0 && Result != 1)) { Diag(Loc, diag::warn_logical_instead_of_bitwise) << RHS.get()->getSourceRange() << (Opc == BO_LAnd ? "&&" : "||"); |