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

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 6 00:13:29 PDT 2020


njames93 added a comment.

Also with a name like compare op parenthesis. It sounds like this would consider `==` and `!=`



================
Comment at: clang/lib/Sema/SemaExpr.cpp:14034
+      << FixItHint::CreateInsertion(LHSExpr->getEndLoc(), ") && ")
+      << FixItHint::CreateInsertion(LHSBO->getRHS()->getBeginLoc(), "(y ")
+      << FixItHint::CreateInsertion(RHSExpr->getEndLoc(), ")");
----------------
You don't want to insert `y` but the source code for `y`


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