[cfe-commits] r142167 - /cfe/trunk/lib/Sema/SemaExpr.cpp

Richard Smith richard-llvm at metafoo.co.uk
Sun Oct 16 16:01:09 PDT 2011


Author: rsmith
Date: Sun Oct 16 18:01:09 2011
New Revision: 142167

URL: http://llvm.org/viewvc/llvm-project?rev=142167&view=rev
Log:
Slightly simplify a constant expression check. No functional change.

Modified:
    cfe/trunk/lib/Sema/SemaExpr.cpp

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=142167&r1=142166&r2=142167&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Sun Oct 16 18:01:09 2011
@@ -6802,10 +6802,10 @@
     // 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 ? "&&" : "||");





More information about the cfe-commits mailing list