r373792 - [clang] fix a typo from r372531
Yuanfang Chen via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 4 14:37:20 PDT 2019
Author: yuanfang
Date: Fri Oct 4 14:37:20 2019
New Revision: 373792
URL: http://llvm.org/viewvc/llvm-project?rev=373792&view=rev
Log:
[clang] fix a typo from r372531
Reviewers: xbolva00
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D68482
Modified:
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/test/Sema/warn-integer-constants-in-ternary.c
Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=373792&r1=373791&r2=373792&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Fri Oct 4 14:37:20 2019
@@ -11384,7 +11384,7 @@ static void DiagnoseIntInBoolContext(Sem
(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);
}
}
Modified: cfe/trunk/test/Sema/warn-integer-constants-in-ternary.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-integer-constants-in-ternary.c?rev=373792&r1=373791&r2=373792&view=diff
==============================================================================
--- cfe/trunk/test/Sema/warn-integer-constants-in-ternary.c (original)
+++ cfe/trunk/test/Sema/warn-integer-constants-in-ternary.c Fri Oct 4 14:37:20 2019
@@ -18,7 +18,7 @@ void test(boolean a) {
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'}}
More information about the cfe-commits
mailing list