[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 Jan 27 22:48:21 PST 2023


hazohelet created this revision.
hazohelet added reviewers: dblaikie, aaron.ballman, erichkeane.
Herald added a project: All.
hazohelet requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a subscriber: sstefan1.
Herald added a project: clang.

This patch introduces a new warning flag `-Wcomparison-op-parentheses` in `-Wparentheses` to issue warnings with its fixit hint for comparison operators within another comparison operator.

This fixes https://github.com/llvm/llvm-project/issues/60256


Repository:
  rG LLVM Github Monorepo

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/Misc/warning-wall.c
  clang/test/Sema/comparison-op-parentheses.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142800.492982.patch
Type: text/x-patch
Size: 8987 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230128/733cb1c6/attachment.bin>


More information about the cfe-commits mailing list