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

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 31 06:45:01 PDT 2022


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 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 :) )


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