Reland "[clang-format][NFC] Clean up fillRanges() in ClangFormat.cpp" (#143477)

Reapply https://github.com/llvm/llvm-project/pull/143236 and fix the bug
reported in
https://github.com/llvm/llvm-project/pull/143236#issuecomment-2957102180.

NOKEYCHECK=True
GitOrigin-RevId: f6eaa2b00cc8d6421934cc92d4b210348809d700
1 file changed