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

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 1 01:35:52 PDT 2022


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:
> > > if this option is false, the transformation would be `if(!(A && B))`, right?
> > > 
> > > should demorgan rules be applied or at least be mentioned here? I think transforming to `if (!A || !B)` is at least a viable option for enough users.
> > Once this is in, I plan to merge some common code with the simplify-boolean-expr logic for things like demorgan processing. Right now the transformation happens, the simplify boolean suggests a demorgan transformation of you run the output through clang tidy.
> a short reference to the `readability-simplify-boolean-expr` check in the user facing docs would be great.
> i personally find it ok if the users "pipe" multiple checks together to reach a final transformation.
> 
> would this check then use the same settings as the `readability-simplify-boolean-expr` check? (that of course off topic and does not relate to this patch :) )
I'm not sure it's really necessary to mention that the fix would likely need another fix, besides that comment would just be removed in the follow up.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130181/new/

https://reviews.llvm.org/D130181



More information about the cfe-commits mailing list