[clang-tools-extra] [clang-tidy] Fix a broken fix-it provided by `modernize-use-integer-sign-comparison` (PR #163488)

Victor Chernyakin via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 14 19:59:54 PDT 2025


================
@@ -152,6 +152,8 @@ void UseIntegerSignComparisonCheck::check(
   if (const auto *RHSCast = llvm::dyn_cast<ExplicitCastExpr>(RHS)) {
     SubExprRHS = RHSCast->getSubExpr();
     R2.setEnd(SubExprRHS->getBeginLoc().getLocWithOffset(-1));
+    R3.setBegin(Lexer::getLocForEndOfToken(
+        SubExprRHS->getEndLoc(), 0, *Result.SourceManager, getLangOpts()));
----------------
localspook wrote:

Notice how (before this change) this branch and the one before it were asymmetric: the previous branch adjusted two ranges (`R1` and `R2`), while this one only adjusted one range (`R2`).

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


More information about the cfe-commits mailing list