[clang-tidy] Fix a false positive in readability-simplify-boolean-expr
Reviewed By: LegalizeAdulthood Differential Revision: https://reviews.llvm.org/D134590 (cherry picked from commit 8c783b8ec78ec857e446a89a35463baed8026f40)
This commit is contained in:
parent
d35bc70e82
commit
dfef316bb3
|
@ -472,8 +472,8 @@ public:
|
|||
checkSingleStatement(If->getThen(), parseReturnLiteralBool);
|
||||
if (ThenReturnBool &&
|
||||
ThenReturnBool.Bool != TrailingReturnBool.Bool) {
|
||||
if (Check->ChainedConditionalReturn ||
|
||||
(!PrevIf && If->getElse() == nullptr)) {
|
||||
if ((Check->ChainedConditionalReturn || !PrevIf) &&
|
||||
If->getElse() == nullptr) {
|
||||
Check->replaceCompoundReturnWithCondition(
|
||||
Context, cast<ReturnStmt>(*Second), TrailingReturnBool.Bool,
|
||||
If, ThenReturnBool.Item);
|
||||
|
|
|
@ -92,3 +92,14 @@ bool complex_chained_if_return_return_negated(int i) {
|
|||
// CHECK-FIXES: {{^}} }{{$}}
|
||||
// CHECK-FIXES: {{^ return i <= 10;$}}
|
||||
// CHECK-FIXES: {{^}$}}
|
||||
|
||||
|
||||
bool PR57819(int x) {
|
||||
// False positive introduced in clang-tidy-15
|
||||
// Expect no warning here.
|
||||
if (x > 0)
|
||||
return false;
|
||||
else {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue