[PATCH] D98237: [clang-format] Option for empty lines after an access modifier.

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 19 09:49:27 PDT 2021


MyDeveloperDay added inline comments.


================
Comment at: clang/unittests/Format/FormatTest.cpp:9212
+  StyleWithLine.EmptyLinesAfterAccessModifier = 1u;
+  EXPECT_EQ(test2NL, format(test0NL, StyleWithLine));
+  EXPECT_EQ(test2NL, format(test1NL, StyleWithLine));
----------------
Max_S wrote:
> HazardyKnusperkeks wrote:
> > Max_S wrote:
> > > MyDeveloperDay wrote:
> > > > yeah I'm not a fan of this like this... sorry... just write the test out in long form, when it goes wrong I don't have to be a compiler to understand what is going wrong I can just see it.
> > > I can change this, but the current output of the tests is (I forced the error):
> > > ```
> > > /<path>/llvm-project/clang/unittests/Format/FormatTest.cpp:72: Failure
> > >       Expected: Expected.str()
> > >       Which is: "class Foo {\nprivate:\n\n  int i;\n};"
> > > To be equal to: format(Expected, Style)
> > >       Which is: "class Foo {\nprivate:\n  int i;\n};"
> > > With diff:
> > > @@ -1,5 @@
> > >  class Foo {
> > >  private:
> > > -
> > >    int i;
> > >  };
> > > ```
> > > 
> > > Which is actually human readable in this case. Shall I still change it?
> > I'm a fan of it. :)
> > Especially with the demonstration that the string is still expanded.
> I changed all to EXPECT_EQ since the failer output there is better. It shows the variables names and not the arbitrary code in verfyFormat. Hope this is ok.
> ```
> /home/msagebaum/Kaiserslautern/Programms/temp/llvm-project/clang/unittests/Format/FormatTest.cpp:9202: Failure
>       Expected: test2NL
>       Which is: "class Foo {\nprivate:\n\n  int i;\n};"
> To be equal to: format(test1NL)
>       Which is: "class Foo {\nprivate:\n  int i;\n};"
> With diff:
> @@ -1,5 @@
>  class Foo {
>  private:
> -
>    int i;
>  };
> 
> ````
why would we break with convention?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98237



More information about the cfe-commits mailing list