diff --git a/clang/lib/Format/IntegerLiteralSeparatorFixer.cpp b/clang/lib/Format/IntegerLiteralSeparatorFixer.cpp --- a/clang/lib/Format/IntegerLiteralSeparatorFixer.cpp +++ b/clang/lib/Format/IntegerLiteralSeparatorFixer.cpp @@ -130,13 +130,12 @@ DigitsPerGroup = Hex; if (DigitsPerGroup > 0 && checkSeparator(Text, DigitsPerGroup)) continue; + const auto &Formatted = format(Text, DigitsPerGroup); + assert(Formatted != Text); if (Start > 0) Location = Location.getLocWithOffset(Start); - if (const auto &Formatted = format(Text, DigitsPerGroup); - Formatted != Text) { - cantFail(Result.add( - tooling::Replacement(SourceMgr, Location, Length, Formatted))); - } + cantFail(Result.add( + tooling::Replacement(SourceMgr, Location, Length, Formatted))); } return {Result, 0}; @@ -153,9 +152,9 @@ return false; I = 0; } else { - ++I; if (I == DigitsPerGroup) return false; + ++I; } }