[PATCH] D85097: [Sema] add warning for comparisons like 'x<=y<=z'
Vince Bridgers via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Aug 2 15:51:25 PDT 2020
vabridgers added inline comments.
================
Comment at: clang/lib/Sema/SemaExpr.cpp:14010
+ << Bop->getSourceRange() << OpLoc;
+ SuggestParentheses(Self, Bop->getOperatorLoc(),
+ Self.PDiag(diag::note_precedence_silence)
----------------
vabridgers wrote:
> lebedev.ri wrote:
> > Should we also suggest the fix to rewrite into what user likely intended?
> > `(x op1 y) && (y op2 z)`
> I'll work on this, post in a next update. Thank you!
Hi @lebedev.ri , the warning emits a note that says "place parentheses around the '<op>' expression to silence this warning" (see the test cases below). Is this sufficient, or are you looking for something else?
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