[PATCH] D142800: [Clang][Diagnostic] Add `-Wcomparison-op-parentheses` to warn on chained comparisons

Takuya Shimizu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 3 09:46:03 PST 2023


hazohelet updated this revision to Diff 502166.
hazohelet added a comment.

Update the differential

- Revise warning messages based on ideas from @aaron.ballman.
- Introduce a new warning flag `-Wchaining-comparisons` that is enabled by default, to warn about chaining relationals or equal operators.
- Adjust existing test files to conform with the new warning settings.


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

https://reviews.llvm.org/D142800

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaExpr.cpp
  clang/test/Analysis/cxx-uninitialized-object.cpp
  clang/test/Misc/warning-wall.c
  clang/test/Sema/bool-compare.c
  clang/test/Sema/chaining-comparisons.c
  clang/test/Sema/comparison-op-parentheses.c
  clang/test/SemaCXX/bool-compare.cpp
  clang/test/SemaCXX/cxx2a-adl-only-template-id.cpp
  clang/test/SemaTemplate/dependent-template-recover.cpp
  clang/test/SemaTemplate/typo-dependent-name.cpp
  clang/test/SemaTemplate/typo-template-name.cpp
  libcxx/test/support/test_comparisons.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142800.502166.patch
Type: text/x-patch
Size: 19124 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230303/085512a0/attachment-0001.bin>


More information about the cfe-commits mailing list