[clang-format] Fix a bug in removing braces for the LLVM style
authorowenca <owenpiano@gmail.com>
Sun, 28 Aug 2022 05:22:50 +0000 (22:22 -0700)
committerowenca <owenpiano@gmail.com>
Sun, 28 Aug 2022 21:22:31 +0000 (14:22 -0700)
commitf00f2b3e8d406c503902117669297b99c40207b6
tree883b14299f7831bde6ad5229c7ff432f31d117e5
parentbb6a437306c4f20d069a84e4cc48e632cacb389f
[clang-format] Fix a bug in removing braces for the LLVM style

When an l_brace is wrapped and the line above it ends with a
comment, the annotator adds ColumnLimit to the TotalLength of the
l_brace, so the actual column position of the l_brace must be
adjusted accordingly.

Fixes #57376.

Differential Revision: https://reviews.llvm.org/D132805
clang/lib/Format/UnwrappedLineParser.cpp
clang/unittests/Format/FormatTest.cpp