[PATCH] D132256: [clang-format] Add DefinitionBlockSpacing option

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 22 13:10:57 PDT 2022


HazardyKnusperkeks added a comment.

In D132256#3738407 <https://reviews.llvm.org/D132256#3738407>, @alecto wrote:

> In D132256#3736076 <https://reviews.llvm.org/D132256#3736076>, @HazardyKnusperkeks wrote:
>
>> Do we want to define the behavior of `MaxEmptyLinesToKeep < DefinitionBlockSpacing`? Then we need tests for that!
>> Tests with `MaxEmptyLinesToKeep < DefinitionBlockSpacing` and initially more than `DefinitionBlockSpacing` should definitely be there.
>
> Hello! To clarify, do you mean there should be unit tests for this behavior, or do you mean that there should be checks in clang-format itself that will alert the user if MaxEmptyLinesToKeep < DefinitionBlockSpacing?

I ask the open question if the behavior should be defined (in howsoever), then there have to be tests, so we can ensure the behavior doesn't regress. Or if it should be undefined, then we don't need tests, because it can do anything.
I don't know if we can actually warn about such things, but we can error out.

I have no opinion on either variant, I just want it to be discussed.

> Also, is the code in the clang-format examples hand-aligned or is there some tool or script used to align/generate it?

You can always just write the code and run the tests, and then take a look at the formatted code and copy-paste it, if it is what you want. That's the way I develop. But the code in the strings has to be put somewhat manually there.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132256/new/

https://reviews.llvm.org/D132256



More information about the cfe-commits mailing list