From 00ab3ae72bf624772fa3ae5c269da54fe944aede Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Sun, 16 Oct 2011 23:01:09 +0000 Subject: [PATCH] Slightly simplify a constant expression check. No functional change. llvm-svn: 142167 --- clang/lib/Sema/SemaExpr.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 0a0009e60215..83002d56956e 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/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 ? "&&" : "||");