<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/69591>69591</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-format. SeparateDefinitionBlocks inserts spaces after attribute like macro
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
yrHeTaTeJlb
</td>
</tr>
</table>
<pre>
My [previous issue](https://github.com/llvm/llvm-project/issues/66759) was closed with incorrect resolution.
The problem is taht `SeparateDefinitionBlocks: Always` treats attribute-like macro incorrectly. USTRUCT(), UCLASS(), UPROPERTY() and UENUM() are not definitions, and clang format *should not insert* an emty line after them.
```
$ cat .clang-format
SeparateDefinitionBlocks: Always
BreakBeforeBraces: Allman
$ cat test.cpp
UENUM()
enum class EEnum
{
Foo,
Bar,
};
USTRUCT()
struct FStruct
{
UPROPERTY()
int baz = 0;
UFUNCTION()
int quux(){}
};
UCLASS()
class FClass
{
void foo(){}
void bar(){}
};
$ clang-format.exe --version
clang-format version 17.0.1 (git://code.qt.io/clang/llvm-project.git 1eee682c1df3ce22d1c53c36f9c44cb4bf3df615)
$ clang-format.exe test.cpp
UENUM()
enum class EEnum
{
Foo,
Bar,
};
USTRUCT()
struct FStruct
{
UPROPERTY()
int baz = 0;
UFUNCTION()
int quux() {}
};
UCLASS()
class FClass
{
void foo() {}
void bar() {}
};
$ cat expected.cpp
UENUM()
enum class EEnum
{
Foo,
Bar,
};
USTRUCT()
struct FStruct
{
UPROPERTY()
int baz = 0;
UFUNCTION()
int quux() {}
};
UCLASS()
class FClass
{
void foo() {}
void bar() {}
};
```
MaxEmptyLinesToKeep has nothing to do there. I neither want my code to get squashed into single block, nor to align everything manually.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVltzqzYQ_jXyy04YkDE2Dzz4Ek9Pe26T2A99FGIBNUIikkji_vqOwPGtSepzTj0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