[PATCH] clang-format: Space and triple angle braces
Daniel Jasper
djasper at google.com
Mon Jan 12 02:02:00 PST 2015
================
Comment at: lib/Format/TokenAnnotator.cpp:68
@@ +67,3 @@
+ // Treat >>> as 3 tokens in this context
+ static int Count;
+ if (Count == 0) Count = 3;
----------------
I really don't like such static variables. Also, now we have two such mechanisms (GreaterStashed and Count). Seems like the same mechanisms should be used.
================
Comment at: lib/Format/TokenAnnotator.cpp:69
@@ +68,3 @@
+ static int Count;
+ if (Count == 0) Count = 3;
+
----------------
In LLVM style, we don't allow one-liner ifs. Use clang-format ..
================
Comment at: lib/Format/TokenAnnotator.cpp:71-73
@@ +70,5 @@
+
+ Left->MatchingParen = CurrentToken;
+ CurrentToken->MatchingParen = Left;
+ CurrentToken->Type = TT_TemplateCloser;
+ --Count;
----------------
Do these lines actually change the behavior? Seems like the entire wrong place to do this.
================
Comment at: lib/Format/TokenAnnotator.cpp:1809
@@ -1794,1 +1808,3 @@
return Style.SpacesInAngles;
+ // Treat parameters in between <<< and >>> similar to template parameters
+ if (Left.is(tok::lesslessless) && Right.isNot(tok::greatergreatergreater))
----------------
So, if we just set TT_TemplateOpener/Closer on these, is this really required?
================
Comment at: unittests/Format/FormatTest.cpp:9616
@@ -9615,1 +9615,3 @@
+TEST_F(FormatTest, TrippleAngleBraces) {
+ verifyFormat("f<<<1, 1>>>();");
----------------
nit: TripleAngleBrackets (one "p" and I don't think that these are "braces").
http://reviews.llvm.org/D6800
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the cfe-commits
mailing list