[PATCH] D104044: [clang-format] Fix the issue that empty lines being removed at the beginning of namespace

Yan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 7 01:45:22 PST 2022


pem added a comment.

I am looking forward for this // EmptyLineInsertion// feature.

In D104044#2813515 <https://reviews.llvm.org/D104044#2813515>, @MyDeveloperDay wrote:

> Do we need a set options for when we want to insert/retain/add a newline after various constructs? frankly I've been mulling over the concept of adding a
>
>   NewLinesBetweenFunctions: 1
>
> I personally don't like code written like this as I find it hard to read, I'd like to be able to mandate a single line between functions
>
>   void foo()
>   {
>   ...
>   }
>   void bar()
>   {
>   ...
>   }
>   void foobar()
>   {
>   ...
>   }
>
> I prefer when its written as:
>
>   void foo()
>   {
>   ...
>   }
>   
>   void bar()
>   {
>   ...
>   }
>   
>   void foobar()
>   {
>   ...
>   }
>
> Maybe we even need a more generalised mechanism that would allow alot of flexibility letting people control their own specific style.
>
>   EmptyLineInsertionStyle: Custom
>         AfterNameSpaceOpeningBrace: 1
>         BeforeNameSpaceClosingBrace: 1
>         BetweenFunctions: 2
>         AfterClassOpeningBrace: 1
>         BeforeClassClosingBrace: 1
>         AfterAccessModifier : 1
>         BeforeAccessModifier: 1




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104044



More information about the cfe-commits mailing list