[PATCH] D68482: [clang] fix a typo from r372531

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 4 14:40:37 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL373792: [clang] fix a typo from r372531 (authored by yuanfang, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D68482?vs=223280&id=223297#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68482/new/

https://reviews.llvm.org/D68482

Files:
  cfe/trunk/lib/Sema/SemaChecking.cpp
  cfe/trunk/test/Sema/warn-integer-constants-in-ternary.c


Index: cfe/trunk/lib/Sema/SemaChecking.cpp
===================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp
+++ cfe/trunk/lib/Sema/SemaChecking.cpp
@@ -11384,7 +11384,7 @@
         (RHS->getValue() == 0 || RHS->getValue() == 1))
       // Do not diagnose common idioms.
       return;
-    if (LHS->getValue() != 0 && LHS->getValue() != 0)
+    if (LHS->getValue() != 0 && RHS->getValue() != 0)
       S.Diag(ExprLoc, diag::warn_integer_constants_in_conditional_always_true);
   }
 }
Index: cfe/trunk/test/Sema/warn-integer-constants-in-ternary.c
===================================================================
--- cfe/trunk/test/Sema/warn-integer-constants-in-ternary.c
+++ cfe/trunk/test/Sema/warn-integer-constants-in-ternary.c
@@ -18,7 +18,7 @@
   boolean r;
   r = a ? (1) : TWO;
   r = a ? 3 : TWO; // expected-warning {{converting the result of '?:' with integer constants to a boolean always evaluates to 'true'}}
-  r = a ? -2 : 0;  // expected-warning {{converting the result of '?:' with integer constants to a boolean always evaluates to 'true'}}
+  r = a ? -2 : 0;
   r = a ? 3 : -2;  // expected-warning {{converting the result of '?:' with integer constants to a boolean always evaluates to 'true'}}
   r = a ? 0 : TWO;
   r = a ? 3 : ONE; // expected-warning {{converting the result of '?:' with integer constants to a boolean always evaluates to 'true'}}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68482.223297.patch
Type: text/x-patch
Size: 1419 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191004/5e307d17/attachment.bin>


More information about the llvm-commits mailing list