[clang-format] Refactoring and asserts in LevelIndentTracker. (NFC)
authorSedenion <39583823+Sedeniono@users.noreply.github.com>
Tue, 18 Jul 2023 20:23:45 +0000 (13:23 -0700)
committerOwen Pan <owenpiano@gmail.com>
Tue, 18 Jul 2023 20:32:07 +0000 (13:32 -0700)
commite4aa1428a28dce38cd4712b5720baa333cbdd25b
treef3fd075dad65754ae53a1b1c045b40677f7fc206
parent4bbf37199c776304981fcd9107492e87d733dde6
[clang-format] Refactoring and asserts in LevelIndentTracker. (NFC)

adjustToUnmodifiedLine: The code does something only for non-PP-directives.
This is now reflected by putting the if-check to the top. This also ensures
that the assert() there is executed only if IndentForLevel is actually
accessed.

getIndent(): assert valid index into IndentForLevel.

Added explanation regarding the intention of IndentForLevel.

Differential Revision: https://reviews.llvm.org/D155094
clang/lib/Format/UnwrappedLineFormatter.cpp