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(), "!(")
+         << FixItHint::CreateInsertion(
----------------
JonasToth wrote:
> did you consider comma expressions?
> 
> `if (myDirtyCode(), myCondition && yourCondition)`. It seems to me, that the 
> transformation would be incorrect.
Comma operator is a binary operator, so the transformation would wrap the whole 
expression in parens.


================
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:
> 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.


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
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to