[PATCH] D84898: [clang-tidy] Add new checker for complex conditions with no meaning

Eugene Zelenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 29 20:02:09 PDT 2020


Eugene.Zelenko added a comment.

May be this check belongs to `bugprone` module?



================
Comment at: clang-tools-extra/docs/ReleaseNotes.rst:75
+
+  Finds complex conditions using <, >, <=, and >= that have no mathematical
+  meaning. 
----------------
Please enclose comparison operators in double back-ticks.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/misc-complex-conditions.rst:6
+
+Detects conditions that have no mathematical meaing.
+
----------------
Please synchronize with statement in Release Notes.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/misc-complex-conditions.rst:8
+
+It's possible to write an expression as (x <= y <= z), which has no meaning.
+This expression is parsed as ((x <= y) x<= z). A compare returns a boolean
----------------
Please enclose statements examples and 0/1 in double back-ticks.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/misc-complex-conditions.rst:44
+
+This check does not include a fixit since it's not reasonable for the checker
+to guess at the programmer's intention.
----------------
fix-it, check.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84898



More information about the cfe-commits mailing list