[PATCH] Formatter: Correctly format stars in `sizeof(int**)` and similar places.
Nico Weber
thakis at chromium.org
Mon Feb 11 09:11:55 PST 2013
================
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)))) {
----------------
Manuel Klimek wrote:
> Indent.
Done.
================
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);
----------------
Manuel Klimek wrote:
> Just out of curiosity: why do you prefer a for loop here?
Loops of the form
init;
while(condition) {
// ...
update;
}
// no use of loop variable after loop
read nicer as for loops for me, and Previous is slightly tighter scoped this way. But I can change it back if you like the old form better.
http://llvm-reviews.chandlerc.com/D384
More information about the cfe-commits
mailing list