Issue 154796
Summary [clang-format] Incorrectly merged empty records with default config
Labels clang-format
Assignees
Reporter itzexpoexpo
    During PR #154580 we noticed that empty records (``struct``,``union``,``class``) get incorrectly merged by clang-format running on default config:
```c++
struct foo {};
struct bar {
  int i;
};
```
This happens even if with `BreakBeforeBraces: Custom` and `BraceWrapping.SplitEmptyRecord: true`.
Expected output in both cases is:
```c++
struct foo {
};
struct bar {
  int i;
};
```

Behavior is correct if `BraceWrapping.AfterStruct: true`:
```c++
struct foo
{
};
struct bar
{
  int i;
};
```

Occurs at least since version 20.1.0 and is likely an issue in `LineJoiner::tryFitMultipleLinesInOne` or it's callees.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to