[clang] fix a typo from r372531

Reviewers: xbolva00

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D68482

llvm-svn: 373792
This commit is contained in:
Yuanfang Chen
2019-10-04 21:37:20 +00:00
parent 784892c964
commit 442ddffe13
2 changed files with 2 additions and 2 deletions

View File

@@ -11384,7 +11384,7 @@ static void DiagnoseIntInBoolContext(Sema &S, Expr *E) {
(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);
}
}

View File

@@ -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'}}