[PATCH] D82824: [clang-tidy] Added option to readability-else-after-return
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 30 09:44:43 PDT 2020
aaron.ballman added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/readability/ElseAfterReturnCheck.cpp:193
if (checkConditionVarUsageInElse(If) != nullptr) {
+ if (!WarnOnConditionVariables)
+ return;
----------------
njames93 wrote:
> aaron.ballman wrote:
> > Would it make sense to hoist this into the previous `if` statement so we don't bother checking the condition var use in the first place if we're just going to ignore the results?
> That wouldn't work, we need to see if there is a condition variable that needs refactoring first before we can disregard it, Or am I missing something?
I was suggesting:
```
if (WarnOnConditionVariables && checkConditionVarUsageInElse(If)) {
...
}
if (WarnOnConditionVariables && checkInitDeclUsageInElse(If) {
...
}
```
The effect is that we don't bother checking for the situations we weren't going to warn about anyway. But maybe I'm the one missing something?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D82824/new/
https://reviews.llvm.org/D82824
More information about the cfe-commits
mailing list