[PATCH] D68482: [clang] fix a typo from r372531
Yuanfang Chen via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 4 13:35:30 PDT 2019
ychen created this revision.
ychen added a reviewer: xbolva00.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D68482
Files:
clang/lib/Sema/SemaChecking.cpp
clang/test/Sema/warn-integer-constants-in-ternary.c
Index: clang/test/Sema/warn-integer-constants-in-ternary.c
===================================================================
--- clang/test/Sema/warn-integer-constants-in-ternary.c
+++ clang/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'}}
Index: clang/lib/Sema/SemaChecking.cpp
===================================================================
--- clang/lib/Sema/SemaChecking.cpp
+++ clang/lib/Sema/SemaChecking.cpp
@@ -11366,7 +11366,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);
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68482.223280.patch
Type: text/x-patch
Size: 1395 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191004/44a80b15/attachment.bin>
More information about the cfe-commits
mailing list