[PATCH] D148467: [clang-format] Add a new AfterCSharpProperty to BraceWrapping

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 17 02:29:30 PDT 2023


HazardyKnusperkeks added inline comments.


================
Comment at: clang/include/clang/Format/Format.h:1220
+    /// \endcode
+    bool AfterCSharpProperty;
   };
----------------
MyDeveloperDay wrote:
> HazardyKnusperkeks wrote:
> > Please sort. :)
> Are we sure we want THIS to be alphabetic, as this changes the initializer order, if someone is using the format() library in downstream code this could subtly break them?
> 
> ```
> Expanded.BraceWrapping = {/*AfterCaseLabel=*/false,
>                             /*AfterClass=*/false,
>                             /*AfterControlStatement=*/FormatStyle::BWACS_Never,
>                             /*AfterEnum=*/false,
>                             /*AfterFunction=*/false,
>                             /*AfterNamespace=*/false,
>                             /*AfterObjCDeclaration=*/false,
>                             /*AfterStruct=*/false,
>                             /*AfterUnion=*/false,
>                             /*AfterExternBlock=*/false,
>                             /*BeforeCatch=*/false,
>                             /*BeforeElse=*/false,
>                             /*BeforeLambdaBody=*/false,
>                             /*BeforeWhile=*/false,
>                             /*IndentBraces=*/false,
>                             /*SplitEmptyFunction=*/true,
>                             /*SplitEmptyRecord=*/true,
>                             /*SplitEmptyNamespace=*/true,
>                             /*AfterCSharpProperty=*/false};
> ```
I'd say yes, we are breaking this stuff always.

Granted this one may compile without an error, but they should get a warning of a missing initializer.

You could add a constructor to initialize out of struct order.


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

https://reviews.llvm.org/D148467



More information about the cfe-commits mailing list