PiotrZSL added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/readability/UseEarlyExitsCheck.cpp:359
+void UseEarlyExitsCheck::registerMatchers(MatchFinder *Finder) {
+ Finder->addMatcher(translationUnitDecl(), this);
+}
----------------
This will trigger on all system code, and then users will complain again that
they see poor clang-tidy performance...
when it could be just something like
```
ifStmt(unless(isExpansionInSystemHeader()),
unless(isConsteval()),
unless(isConstexpr()),
unless(hasElse(stmt())),
unless(hasInitStatement(stmt()),
hasThen(compoundStmt(hasSizeAboeLineTreshold())),
...
```
Simply everything that could be put into matcher should be put into matcher
(easier to maintain), also what's a point of checking functions that doesn't
have if's. On that point also some implicit functions or if statement should be
ignored, to avoid checking templates twice.
================
Comment at:
clang-tools-extra/test/clang-tidy/checkers/readability/use-early-exits.cpp:144
+ // CHECK-FIXES-NEXT: }
+}
----------------
- Missing test with if in template function & implicit specialization, just to
make sure that fixes won't get to mess up.
- Missing test with if under macro.
- Missing test with if under switch under loop (to check if brak/continue will
be used correctly, instead of return).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130181/new/
https://reviews.llvm.org/D130181
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits