[PATCH] Insert extra new line before access specifiers.

Daniel Jasper djasper at google.com
Wed Mar 27 07:23:42 PDT 2013



================
Comment at: lib/Format/Format.cpp:1383
@@ +1382,3 @@
+              (I - 1)->Last->isOneOf(tok::semi, tok::r_brace) &&
+              Tok.isOneOf(tok::kw_public, tok::kw_private, tok::kw_protected) &&
+              Tok.Children.size() > 0 && Tok.Children[0].is(tok::colon) &&
----------------
I think you should add tok::comment to this list (and a test).

================
Comment at: lib/Format/Format.cpp:1380
@@ +1379,3 @@
+          AnnotatedToken Tok = TheLine.First;
+          if (I != AnnotatedLines.begin() &&
+              (I - 1)->Last &&
----------------
Can you use clang-format on this line, even if you don't like the result as much?

================
Comment at: lib/Format/Format.cpp:1386
@@ +1385,3 @@
+              Tok.FormatTok.NewlinesBefore == 1)
+            ++Tok.FormatTok.NewlinesBefore;
+
----------------
- I think changing the FormatTokens is a bad idea. We try to regard them as constant after coming out of the UnwrappedLineParser.
- Can you move this logic into formatFirstToken()? You will need an additional parameter, e.g. last Token(Kind) of the previous line, but that shouldn't be too bad. I think doing this actually makes sense for both current calls of formatFirstToken().


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



More information about the cfe-commits mailing list