File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -472,8 +472,8 @@ class SimplifyBooleanExprCheck::Visitor : public RecursiveASTVisitor<Visitor> {
472
472
checkSingleStatement (If->getThen (), parseReturnLiteralBool);
473
473
if (ThenReturnBool &&
474
474
ThenReturnBool.Bool != TrailingReturnBool.Bool ) {
475
- if (Check->ChainedConditionalReturn ||
476
- (!PrevIf && If->getElse () == nullptr ) ) {
475
+ if (( Check->ChainedConditionalReturn || !PrevIf) &&
476
+ If->getElse () == nullptr ) {
477
477
Check->replaceCompoundReturnWithCondition (
478
478
Context, cast<ReturnStmt>(*Second), TrailingReturnBool.Bool ,
479
479
If, ThenReturnBool.Item );
Original file line number Diff line number Diff line change @@ -92,3 +92,14 @@ bool complex_chained_if_return_return_negated(int i) {
92
92
// CHECK-FIXES: {{^}} }{{$}}
93
93
// CHECK-FIXES: {{^ return i <= 10;$}}
94
94
// CHECK-FIXES: {{^}$}}
95
+
96
+
97
+ bool PR57819 (int x) {
98
+ // False positive introduced in clang-tidy-15
99
+ // Expect no warning here.
100
+ if (x > 0 )
101
+ return false ;
102
+ else {
103
+ }
104
+ return true ;
105
+ }
You can’t perform that action at this time.
0 commit comments