llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[clang-format] Single-line enum wrapping with `ColumnLimit: 0`

Open figuld opened this issue 4 weeks ago • 2 comments

On this config value, single line enums, with >= 2 elements, unexpectedly wrap, with the next elements being aligned with the first.

Does not happen at ColumnLimit = 90. Using clang-format version 23.1.3, same issue on 21.1.8, 19.1.7.

Minimal config

IndentWidth: 4
BreakBeforeBraces: Linux

ColumnLimit: 0

Input, also output with ColumnLimit = 90

int main()
{
    enum { WINDOW_WIDTH = 1080, WINDOW_HEIGHT = 720 };
}

Incorrect output with ColumnLimit = 0

int main()
{
    enum { WINDOW_WIDTH = 1080,
           WINDOW_HEIGHT = 720 };
}

figuld avatar Nov 05 '26 10:11 figuld

@llvm/issue-subscribers-clang-format

Author: figuld

On this config value, single line enums, with >= 2 elements, unexpectedly wrap, with the next elements being aligned with the first.

Does not happen at ColumnLimit = 90. Using clang-format version 23.1.3, same issue on 21.1.8, 19.1.7.

Minimal config

IndentWidth: 4
BreakBeforeBraces: Linux

ColumnLimit: 0

Input, also output with ColumnLimit = 90

int main()
{
    enum { WINDOW_WIDTH = 1080, WINDOW_HEIGHT = 720 };
}

Incorrect output with ColumnLimit = 0

int main()
{
    enum { WINDOW_WIDTH = 1080,
           WINDOW_HEIGHT = 720 };
}

hi i'm investigating this issue. i'll try reproducing it on main and add a regression test alongside a fix if i can figure out what's going on!

VedaantS avatar Nov 07 '26 19:11 VedaantS