Pull out common base class for formatting unit tests, removing duplicate
code that accumulated over the years.
Pull out macro expansion test into its own test file.
Account for an r_brace that precedes an "else if" statement when
calculating whether the line might fit on one line if the r_brace
is removed.
Fixes#59778.
Differential Revision: https://reviews.llvm.org/D140835
This reverts commit e33243c950ac40d027ad8facbf7ccf0624604a16 but
keeps the added test case and also adds another test case.
Fixes#59417.
Differential Revision: https://reviews.llvm.org/D139760
This includes TT_MacroBlockBegin and TT_MacroBlockEnd as well.
We can no longer use MatchingParen of FormatToken as an indicator
to mark optional braces. Instead, we directly set Optional of an
l_brace first and reset it later if it turns out that the braces
are not optional.
Also added a test case for deeply nested loops.
Differential Revision: https://reviews.llvm.org/D139257