[clang-format] Avoid breaking )( with BlockIndent
authorGedare Bloom <gedare@rtems.org>
Tue, 6 Dec 2022 08:58:30 +0000 (00:58 -0800)
committerOwen Pan <owenpiano@gmail.com>
Tue, 6 Dec 2022 09:04:51 +0000 (01:04 -0800)
commitb40e9dce0a67beab352f7b7be43f13190f69b69c
tree5478a4aab05c9a8eb0bc61042c527e628ea2d4b9
parentca0b4d58eaad405ea74b4db82ecb14b3cfdeccb7
[clang-format] Avoid breaking )( with BlockIndent

The BracketAlignmentStyle BAS_BlockIndent was forcing breaks before a
closing right parenthesis yielding strange-looking results in case of
code structures that have a left parens immediately following a right
parens ")(" such as is seen with indirect function calls via function
pointers and with type casting.

Fixes 57250.
Fixes 58496.

Differential Revision: https://reviews.llvm.org/D137762
clang/lib/Format/ContinuationIndenter.cpp
clang/lib/Format/TokenAnnotator.cpp
clang/unittests/Format/FormatTest.cpp