[PATCH] D85097: [Sema] add warning for comparisons like 'x<=y<=z'

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 2 11:04:19 PDT 2020


lebedev.ri added a comment.

Thank you! I strongly prefer this path forward.



================
Comment at: clang/lib/Sema/SemaExpr.cpp:14010
+      << Bop->getSourceRange() << OpLoc;
+  SuggestParentheses(Self, Bop->getOperatorLoc(),
+                     Self.PDiag(diag::note_precedence_silence)
----------------
Should we also suggest the fix to rewrite into what user likely intended?
`(x op1 y) && (y op2 z)`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85097



More information about the cfe-commits mailing list