[PATCH] D130181: [clang-tidy] Add readability-use-early-exits check

2023-03-23 Thread Nathan James via Phabricator via cfe-commits
njames93 added inline comments. Comment at: clang-tools-extra/clang-tidy/readability/UseEarlyExitsCheck.cpp:359 +void UseEarlyExitsCheck::registerMatchers(MatchFinder *Finder) { + Finder->addMatcher(translationUnitDecl(), this); +} PiotrZSL wrote: > This will

[PATCH] D130181: [clang-tidy] Add readability-use-early-exits check

2023-03-23 Thread Piotr Zegar via Phabricator via cfe-commits
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

[PATCH] D130181: [clang-tidy] Add readability-use-early-exits check

2023-03-22 Thread Nathan James via Phabricator via cfe-commits
njames93 added a comment. In D130181#4213779 , @LegalizeAdulthood wrote: > I'm not certain that the result of the transformation is more "readable"; is > this check intended to aid conformance to a style guide? One of the driving factors of this is

[PATCH] D130181: [clang-tidy] Add readability-use-early-exits check

2023-03-22 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added a comment. Herald added a subscriber: PiotrZSL. I'm not certain that the result of the transformation is more "readable"; is this check intended to aid conformance to a style guide? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D130181: [clang-tidy] Add readability-use-early-exits check

2022-09-19 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added a comment. In D130181#3769618 , @njames93 wrote: > In D130181#3769083 , @JonasToth > wrote: > >> ... > > Your concerns aren't actually that important. Because the transformations > only work on

[PATCH] D130181: [clang-tidy] Add readability-use-early-exits check

2022-09-05 Thread Nathan James via Phabricator via cfe-commits
njames93 added a comment. In D130181#3769083 , @JonasToth wrote: > ... Your concerns aren't actually that important. Because the transformations only work on for binary operators, and not CXXOperatorCallExpr, it would always never do any special

[PATCH] D130181: [clang-tidy] Add readability-use-early-exits check

2022-09-04 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added a comment. IMHO the check looks good, but I do have concerns about correctness of the transformation in specific cases, especially overloaded operators. If the conditions are inverted, it might be the case that the inverted operator is not overloaded, resulting in compilation

[PATCH] D130181: [clang-tidy] Add readability-use-early-exits check

2022-09-01 Thread Nathan James via Phabricator via cfe-commits
njames93 added inline comments. Comment at: clang-tools-extra/docs/clang-tidy/checks/readability/use-early-exits.rst:63 +void Process(bool A, bool B) { + if (A && B) { +// Long processing. JonasToth wrote: > njames93 wrote: > > JonasToth wrote:

[PATCH] D130181: [clang-tidy] Add readability-use-early-exits check

2022-09-01 Thread Nathan James via Phabricator via cfe-commits
njames93 updated this revision to Diff 457199. njames93 marked 3 inline comments as done. njames93 added a comment. Fix documentation. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D130181/new/ https://reviews.llvm.org/D130181 Files:

[PATCH] D130181: [clang-tidy] Add readability-use-early-exits check

2022-08-31 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added inline comments. Comment at: clang-tools-extra/docs/clang-tidy/checks/readability/use-early-exits.rst:63 +void Process(bool A, bool B) { + if (A && B) { +// Long processing. njames93 wrote: > JonasToth wrote: > > if this option

[PATCH] D130181: [clang-tidy] Add readability-use-early-exits check

2022-08-30 Thread Nathan James via Phabricator via cfe-commits
njames93 marked an inline comment as done. njames93 added inline comments. Comment at: clang-tools-extra/clang-tidy/readability/UseEarlyExitsCheck.cpp:66 + if (needsParensAfterUnaryNegation(Condition)) { +Diag << FixItHint::CreateInsertion(Condition->getBeginLoc(), "!(") +

[PATCH] D130181: [clang-tidy] Add readability-use-early-exits check

2022-08-29 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added a comment. just my 2 cents Comment at: clang-tools-extra/clang-tidy/readability/UseEarlyExitsCheck.cpp:66 + if (needsParensAfterUnaryNegation(Condition)) { +Diag << FixItHint::CreateInsertion(Condition->getBeginLoc(), "!(") + <<

[PATCH] D130181: [clang-tidy] Add readability-use-early-exits check

2022-08-21 Thread Nathan James via Phabricator via cfe-commits
njames93 updated this revision to Diff 454275. njames93 added a comment. Add NestedControlFlow options This option can be used to silence diagnostics when there aren't any nested blocks inside the if statement. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D130181: [clang-tidy] Add readability-use-early-exits check

2022-08-18 Thread Nathan James via Phabricator via cfe-commits
njames93 added a comment. Ping? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D130181/new/ https://reviews.llvm.org/D130181 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D130181: [clang-tidy] Add readability-use-early-exits check

2022-08-11 Thread Nathan James via Phabricator via cfe-commits
njames93 updated this revision to Diff 451856. njames93 added a comment. Refactor some of the impl. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D130181/new/ https://reviews.llvm.org/D130181 Files:

[PATCH] D130181: [clang-tidy] Add readability-use-early-exits check

2022-08-01 Thread Nathan James via Phabricator via cfe-commits
njames93 updated this revision to Diff 449048. njames93 added a comment. Rebase and Ping?? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D130181/new/ https://reviews.llvm.org/D130181 Files: clang-tools-extra/clang-tidy/readability/CMakeLists.txt

[PATCH] D130181: [clang-tidy] Add readability-use-early-exits check

2022-07-27 Thread Nathan James via Phabricator via cfe-commits
njames93 updated this revision to Diff 447967. njames93 added a comment. Fix typo in check list documentation. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D130181/new/ https://reviews.llvm.org/D130181 Files:

[PATCH] D130181: [clang-tidy] Add readability-use-early-exits check

2022-07-25 Thread Nathan James via Phabricator via cfe-commits
njames93 updated this revision to Diff 447246. njames93 added a comment. NL Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D130181/new/ https://reviews.llvm.org/D130181 Files: clang-tools-extra/clang-tidy/readability/CMakeLists.txt

[PATCH] D130181: [clang-tidy] Add readability-use-early-exits check

2022-07-25 Thread Nathan James via Phabricator via cfe-commits
njames93 updated this revision to Diff 447236. njames93 added a comment. Add option `SplitConjunctions` to alter fix-it for `if` statements with `&&` in the condition. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D130181/new/

[PATCH] D130181: [clang-tidy] Add readability-use-early-exits check

2022-07-20 Thread Nathan James via Phabricator via cfe-commits
njames93 updated this revision to Diff 446255. njames93 added a comment. Fix pre-build failing. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D130181/new/ https://reviews.llvm.org/D130181 Files:

[PATCH] D130181: [clang-tidy] Add readability-use-early-exits check

2022-07-20 Thread Nathan James via Phabricator via cfe-commits
njames93 updated this revision to Diff 446219. njames93 added a comment. Added logic to infer WrapInBraces option if unspecified. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D130181/new/ https://reviews.llvm.org/D130181 Files:

[PATCH] D130181: [clang-tidy] Add readability-use-early-exits check

2022-07-20 Thread Nathan James via Phabricator via cfe-commits
njames93 added inline comments. Comment at: clang-tools-extra/clang-tidy/readability/UseEarlyExitsCheck.cpp:217 + LineCountThreshold(Options.get("LineCountThreshold", 10U)), + WrapInBraces(Options.get("WrapInBraces", false)) {} + I have an idea that we

[PATCH] D130181: [clang-tidy] Add readability-use-early-exits check

2022-07-20 Thread Nathan James via Phabricator via cfe-commits
njames93 updated this revision to Diff 446197. njames93 added a comment. Add option to wrap early exit in braces. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D130181/new/ https://reviews.llvm.org/D130181 Files:

[PATCH] D130181: [clang-tidy] Add readability-use-early-exits check

2022-07-20 Thread Eugene Zelenko via Phabricator via cfe-commits
Eugene.Zelenko added inline comments. Comment at: clang-tools-extra/docs/clang-tidy/checks/readability/use-early-exits.rst:52 + many lines. Default value is `10`. \ No newline at end of file Please add newline. Repository: rG LLVM Github Monorepo CHANGES

[PATCH] D130181: [clang-tidy] Add readability-use-early-exits check

2022-07-20 Thread Nathan James via Phabricator via cfe-commits
njames93 created this revision. njames93 added reviewers: alexfh, aaron.ballman. Herald added subscribers: carlosgalvezp, xazax.hun, mgorny. Herald added a project: All. njames93 requested review of this revision. Herald added a project: clang-tools-extra. Herald added a subscriber: cfe-commits.