[PATCH] D78982: [clang-format] Fix Microsoft style for enums

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 29 14:33:40 PDT 2020


MyDeveloperDay added inline comments.


================
Comment at: clang/lib/Format/Format.cpp:1143
   Style.PenaltyReturnTypeOnItsOwnLine = 1000;
+  Style.AllowShortEnumsOnASingleLine = (Language != FormatStyle::LK_Cpp);
   Style.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_None;
----------------
asmith wrote:
> MyDeveloperDay wrote:
> > asmith wrote:
> > > MyDeveloperDay wrote:
> > > > I think its ok to leave it was, just if up the unit tests
> > > > 
> > > > (the fact you didn't see this suggests you are not running the unit tests please ensure you are)
> > > You need to use the latest changes. The is only applied when the style is Msft and C++. See the GetMicrosoftStyle() method.
> > I don't think you should change the style based on the language here, either on or off, but not changing based on language because what about "ObjectiveC"?
> > 
> > As I added the Microsoft style to allow C# development I think its ok to set this to what you originally had, but fix up the tests
> Ive enabled this for C#. I don't see the connection between ObjectiveC and Microsoft Style.
The Microsoft style was a style we added to try and give us a unique style to setup for C#, but that wouldn't stop a user for using it for other languages

Saying that you want a style for C++ but not other C based languges feels a little odd

Its perfectly acceptable for someone using Objective-C to use the BasedOnStyle of Microsoft

as such I think its better for a style to have a set default, then let users modify from the default.




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

https://reviews.llvm.org/D78982





More information about the cfe-commits mailing list