[PATCH] Added the Allman brace style

Manuel Klimek klimek at google.com
Tue May 28 07:33:14 PDT 2013



================
Comment at: lib/Format/UnwrappedLineParser.cpp:210
@@ -209,1 +209,3 @@
     case tok::l_brace:
+      if (Style.BreakBeforeBraces == FormatStyle::BS_Allman)
+          addUnwrappedLine();
----------------
I think this is unnecessary - see my test idea below.

================
Comment at: unittests/Format/FormatTest.cpp:4584
@@ +4583,3 @@
+               "}\n"
+               "}",
+               BreakBeforeBrace);
----------------
Missing tests:
- top-level block (in parseLevel)
{
}
- extern decl
extern "C"
{
}
- else (put it after your if)
- while loop
- do while loop
- switch/label:
switch (42)
{
  case 1:
  {
  }
}
- enum

Please make sure the test actually breaks if each of the additional checks is commented out.


http://llvm-reviews.chandlerc.com/D880



More information about the cfe-commits mailing list