[PATCH] D133102: [clang-tidy] Extend simplify-boolean-expr check

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


njames93 created this revision.
njames93 added reviewers: aaron.ballman, JonasToth, LegalizeAdulthood, alexfh.
Herald added subscribers: carlosgalvezp, xazax.hun.
Herald added a project: All.
njames93 requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

Extend the check to catch these conditions:

  if (e) return true; else return x;  // return e || x;
  if (e) return false; else return x; // return !e && x;
  if (e) return true; return x;       // return e || x;
  if (e) return false; return x;      // return !e && x;


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D133102

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-case.cpp
  clang-tools-extra/test/clang-tidy/checkers/readability/simplify-bool-expr.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133102.457227.patch
Type: text/x-patch
Size: 14171 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220901/863b8b62/attachment-0001.bin>


More information about the cfe-commits mailing list