[PATCH] Formatter: Correctly format stars in `sizeof(int**)` and similar places.

Manuel Klimek klimek at google.com
Sun Feb 10 23:38:41 PST 2013


  Makes sense to me, but I'll punt to daniel for the final lg.


================
Comment at: lib/Format/TokenAnnotator.cpp:532
@@ -529,3 +531,3 @@
       Contexts.back().IsExpression = true;
-      AnnotatedToken *Previous = Current.Parent;
-      while (Previous != NULL && Previous->isNot(tok::comma)) {
+      for (AnnotatedToken *Previous = Current.Parent;
+           Previous && Previous->isNot(tok::comma);
----------------
Just out of curiosity: why do you prefer a for loop here?

================
Comment at: lib/Format/TokenAnnotator.cpp:541
@@ -540,1 +540,3 @@
+    } else if (Current.is(tok::kw_return) || Current.is(tok::kw_throw) ||
         (Current.is(tok::l_paren) && !Line.MustBeDeclaration &&
+         (Current.Parent == NULL || Current.Parent->isNot(tok::kw_for)))) {
----------------
Indent.


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



More information about the cfe-commits mailing list