[PATCH] D124650: [clang-tidy] Simplify boolean expressions by DeMorgan's theorem

Richard via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 28 17:30:01 PDT 2022


LegalizeAdulthood created this revision.
LegalizeAdulthood added reviewers: aaron.ballman, njames93.
LegalizeAdulthood added projects: clang-tools-extra, All.
Herald added subscribers: carlosgalvezp, xazax.hun.
LegalizeAdulthood requested review of this revision.

Make the following simplifications of boolean expressions:

  !(!a ||  b) =>  a && !b
  !( a || !b) => !a && b
  !(!a || !b) =>  a && b
  !(!a &&  b) =>  a || !b
  !( a && !b) => !a || b
  !(!a && !b) =>  a || b

Fixes #55092


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D124650

Files:
  clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.cpp
  clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.h
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/readability-simplify-boolean-expr.rst
  clang-tools-extra/test/clang-tidy/checkers/readability-simplify-bool-expr-demorgan.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124650.425935.patch
Type: text/x-patch
Size: 12382 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220429/22da9cdd/attachment-0001.bin>


More information about the cfe-commits mailing list