Inspired by discussion in https://reviews.llvm.org/D91037
Details
Diff Detail
Event Timeline
Thank you for working on this!
| clang-tools-extra/test/clang-tidy/checkers/bugprone-redundant-branch-condition.cpp | ||
|---|---|---|
| 10 | Did you mean for the parameter to be a reference? | |
| 963 | FWIW, I would expect this one to be diagnosed if the call really was byval instead of byref. | |
| 968 | Another test that would be interesting is: if (tryToExtinguish(isSet) && isSet) {
if (tryToExtinguishByVal(isSet) && isSet) { // Dupe check of isSet should be diagnosed
scream();
}
}
if (tryToExtinguishByVal(isSet) && isSet) {
if (tryToExtinguish(isSet) && isSet) { // Ok
scream();
}
} | |
| clang-tools-extra/test/clang-tidy/checkers/bugprone-redundant-branch-condition.cpp | ||
|---|---|---|
| 968 | Nice catch! Thanks. Looks like isChangedBefore is too rough and must be refined | |
| clang-tools-extra/clang-tidy/bugprone/RedundantBranchConditionCheck.cpp | ||
|---|---|---|
| 35 | I think this comment should be hoisted above to update the comment on line 32. | |
| 49 | 80-col limit issue -- you should run the patch through clang-format. | |
| 77 | const auto *, but I think this would be better expressed as: const DeclRefExpr *OuterIfVar, *InnerIfVar; if (const auto *Outer = Result.Nodes.getNodeAs<DeclRefExpr>(OuterIfVar1Str)) OuterIfVar = Outer; else OuterIfVar = Result.Nodes.getNodeAs<DeclRefExpr>(OuterIfVar2Str); // Similar for InnerIfVar | |
I think this comment should be hoisted above to update the comment on line 32.