During PR #154580 we noticed that empty records (struct,union,class) get incorrectly merged by clang-format running on default config:
struct foo {};
struct bar {
int i;
};
This happens even with BreakBeforeBraces: Custom and BraceWrapping.SplitEmptyRecord: true.
Expected output in both cases is:
struct foo {
};
struct bar {
int i;
};
Behavior is correct if BraceWrapping.AfterStruct: true:
struct foo
{
};
struct bar
{
int i;
};
Occurs at least since version 12.0.0 and is likely an issue in LineJoiner::tryFitMultipleLinesInOne or it's callees.