- Add or remove empty lines surrounding unions
- Fixes https://github.com/llvm/llvm-project/issues/53229, in which keywords like class and struct in a line ending with left brace or whose next line is left brace only, will be falsely recognized as definition line, causing extra empty lines inserted surrounding blocks with no need to be formatted.
Details
Diff Detail
Event Timeline
Looks ok but please rework the tests to keep previous cases untouched.
clang/unittests/Format/DefinitionBlockSeparatorTest.cpp | ||
---|---|---|
305 | I'd rather see this added in another function e.g. bar3, because otherwise you don't test what was tested before. |
- Add or remove empty lines surrounding unions.
- Move new test location.
- Remove else immediately above return.
clang/lib/Format/DefinitionBlockSeparator.cpp | ||
---|---|---|
41 | This is also an else after return. ;) |
LGTM.
clang/unittests/Format/DefinitionBlockSeparatorTest.cpp | ||
---|---|---|
305 | When I wrote this comment I thought that bar3 didn't exist... But well, I think I'll create a patch to clean up these tests a bit anyway. |
clang/unittests/Format/DefinitionBlockSeparatorTest.cpp | ||
---|---|---|
305 | Thank you very much for this! |
I would prefer a switch over the tokens.
But definitely no else after return.