[PATCH] D144429: [clang-tidy] Add bugprone-chained-comparison check
Piotr Zegar via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 20 13:43:35 PST 2023
PiotrZSL created this revision.
Herald added subscribers: carlosgalvezp, xazax.hun.
Herald added a reviewer: njames93.
Herald added a project: All.
PiotrZSL added a comment.
PiotrZSL published this revision for review.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.
Note that looks like there is currently in implementation new warning -Wcomparison-op-parentheses under D142800 <https://reviews.llvm.org/D142800>, that warning currently handle only chained comparison by using BinaryOperator, not by using CXXOperatorCallExpr.
Scope of "-Wcomparison-op-parentheses" and whatever that warning will be delivered in LLVM 17 will determinate future of this check.
This check is feature-complete.
Check that flags chained comparison expressions,
such as a < b < c or a == b == c, which may have
unintended behavior due to implicit operator
associativity.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D144429
Files:
clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt
clang-tools-extra/clang-tidy/bugprone/ChainedComparisonCheck.cpp
clang-tools-extra/clang-tidy/bugprone/ChainedComparisonCheck.h
clang-tools-extra/docs/ReleaseNotes.rst
clang-tools-extra/docs/clang-tidy/checks/bugprone/chained-comparison.rst
clang-tools-extra/docs/clang-tidy/checks/list.rst
clang-tools-extra/test/clang-tidy/checkers/bugprone/chained-comparison.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144429.498945.patch
Type: text/x-patch
Size: 17886 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230220/35cf13d3/attachment-0001.bin>
More information about the cfe-commits
mailing list