[PATCH] D93938: [clang-format] Fixed AfterEnum handling
Mike Weller via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 22 06:17:08 PDT 2021
Userbla added a comment.
In D93938#2832825 <https://reviews.llvm.org/D93938#2832825>, @Userbla wrote:
> I applied this fix locally to a branch based off llvm 11.x and the `FormatTest.FormatsTypedefEnum` test now fails.
So this test is failing:
TEST_F(FormatTest, LongEnum) {
FormatStyle Style = getLLVMStyle();
Style.AllowShortEnumsOnASingleLine = true;
Style.ColumnLimit = 40;
Style.BreakBeforeBraces = FormatStyle::BS_Custom;
Style.BraceWrapping.AfterEnum = false;
verifyFormat("enum {\n"
" ZERO = 0,\n"
" ONE = 1,\n"
" TWO = 2,\n"
" THREE = 3\n"
"} LongEnum;",
Style);
Style.BreakBeforeBraces = FormatStyle::BS_Custom;
Style.BraceWrapping.AfterEnum = true;
verifyFormat("enum\n"
"{\n"
" ZERO = 0,\n"
" ONE = 1,\n"
" TWO = 2,\n"
" THREE = 3\n"
"} LongEnum;",
Style);
}
It fails in the second case because we don't respect the 'AfterEnum = true' and collapse the brace. It appears there is buggy logic in the `remainingLineCharCount` stuff which others have already been commenting on
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D93938/new/
https://reviews.llvm.org/D93938
More information about the cfe-commits
mailing list