[clang-tools-extra] [clang-tidy][NFC] Clean up and slightly optimize `modernize-use-integer-sign-comparison` (PR #163492)

Victor Chernyakin via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 14 21:26:46 PDT 2025


================
@@ -144,8 +136,7 @@ void UseIntegerSignComparisonCheck::check(
       RHS->getEndLoc(), 0, *Result.SourceManager, getLangOpts()));
   if (const auto *LHSCast = llvm::dyn_cast<ExplicitCastExpr>(LHS)) {
     SubExprLHS = LHSCast->getSubExpr();
-    R1 = SourceRange(LHS->getBeginLoc(),
-                     SubExprLHS->getBeginLoc().getLocWithOffset(-1));
+    R1.setEnd(SubExprLHS->getBeginLoc().getLocWithOffset(-1));
----------------
localspook wrote:

At this point, `R1`'s begin location is already equal to `LHS->getBeginLoc()`, so we only need to update the end location

https://github.com/llvm/llvm-project/pull/163492


More information about the cfe-commits mailing list