Fix generated by this check changed program semantics
in the case where 'if' was a part (direct child) of other statement.
Fixes PR30652
Differential D26125
[clang-tidy] Fixed readability-else-after-return for cascade statements idlecode on Oct 30 2016, 1:30 AM. Authored by
Details Fix generated by this check changed program semantics Fixes PR30652
Diff Detail
Event Timeline
Comment Actions With this fix, is there still a warning on the following code? if(b) { ... if(c) return; else doSomething() ... } I would expect that the check still warns on it. Comment Actions @mgehre: Yes it does - in your case AST looks like ifStmt(b) - CompoundStmt - ifStmt(c), so ifStmt's don't have direct parent-child relations. while(a) if (b) return 1; else doSomething(2); In such case, generated fix (with and without this fix) will change semantics of program. Comment Actions I have reverted matcher to the state before https://reviews.llvm.org/D23265 (tests are passing with compoundStmt instead of stmt and this way is better than mine). |