aboutsummaryrefslogtreecommitdiff
path: root/unittests/Format
AgeCommit message (Collapse)Author
2013-02-06Parse record declarations with token pasted identifiers.Manuel Klimek
This is pretty common in macros: #define A(X, Y) class X##Y {}; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174512 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-06Fix a formatting bug caused by comments in expressions.Daniel Jasper
This fixes llvm.org/PR15162. Before: bool aaaaaaaaaaaaa = // comment aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa || aaaaaaaaaaaaaaaaaaaaaaaaaaaa || aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa || aaaaaaaaaaaaaaaaaaaaaaaaaaaaa; After: bool aaaaaaaaaaaaa = // comment aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa || aaaaaaaaaaaaaaaaaaaaaaaaaaaa || aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa || aaaaaaaaaaaaaaaaaaaaaaaaaaaaa; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174508 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-06Optionally derive formatting information from the input file.Daniel Jasper
With this patch, clang-format can analyze the input file for two properties: 1. Is "int *a" or "int* a" more common. 2. Are non-C++03 constructs used, e.g. A<A<A>>. With Google-style, clang-format will now use the more common style for (1) and format C++03 compatible, unless it finds C++11 constructs in the input. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174504 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-06Fix an issue with the formatting of stars in default values.Daniel Jasper
Before: void f(int *a = d *e, int b = 0); After: void f(int *a = d * e, int b = 0); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174500 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-06Handle nested ObjC calls.Daniel Jasper
Properly handle annotation contexts while calculating extra information for each token. This enable nested ObjC calls and thus solves (most of) llvm.org/PR15164. E.g., we can now format: [contentsContainer replaceSubview:[subviews objectAtIndex:0] with:contentsNativeView]; Also fix a problem with the formatting of types in casts as this was trivial now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174498 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-06Formatter: No space after & and * in front of ObjC message expressions.Nico Weber
1. let determineStarAmp() check of unary operators before checking for "is next '['". That check was added in r173150, and the test from that revision passes either way. 2. change determineStarAmp() to categorize '*' and '&' after '=' as unary operator. 3. don't let parseSquare() overwrite the type of a '*' or '&' before the start of an objc message expression if has the role of unary operator. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174489 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-05Formatter: Detect ObjC method expressions after unary operators.Nico Weber
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174384 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-05Initial support for formatting ObjC method declarations/calls.Daniel Jasper
We can now format stuff like: - (void)doSomethingWith:(GTMFoo *)theFoo rect:(NSRect)theRect interval:(float)theInterval { [myObject doFooWith:arg1 // name:arg2 error:arg3]; } This seems to fix everything mentioned in llvm.org/PR14939. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174364 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-05Fix some linebreak decisions in Google format.Daniel Jasper
Before: f(aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaa); aaaaaaa(aaaaaaaaaaaaa, aaaaaaaaaaaaa, aaaaaaaaaaaaa(aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaa)); After: f(aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaa); aaaaaaa(aaaaaaaaaaaaa, aaaaaaaaaaaaa, aaaaaaaaaaaaa(aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaa)); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174363 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-05Fix formatting regression introduced by r174307.Daniel Jasper
In preprocessor definitions, we would not parse all the tokens and thus not annotate them anymore. This led to a wrong formatting of comments in google style: #endif // HEADER_GUARD -- requires two spaces git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174361 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-04Improve handling of trailing block commentsDaniel Jasper
This is a follow up to r174309 to actually make it work. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174314 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-04Improve formatting of stream operators.Daniel Jasper
If there are string literals on either side of a '<<', chances are high that they represent logically separate concepts. Otherwise, the author could just have just a single literal (possible split over multiple lines). So, we can now nicely format things like: cout << "somepacket = {\n" << " val a = " << ValueA << "\n" << " val b = " << ValueB << "\n" << "}"; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174310 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-04Improve handling of trailing block comments.Daniel Jasper
We can now (even in non-bin-packing modes) format: someFunction(1, /* comment 1 */ 2, /* comment 2 */ 3, /* comment 3 */ aaa); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174309 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-04Fix an error in formatting of for-loops.Daniel Jasper
Two minor changes: * Slight penalty for breaking at "," as opposed to ";". * Don't apply bin-packing rules to for-loops. Before: for (int aaaaaa = aaaaaaaaaa; aaaaaa < bbbbbbbb; ++aaaaaa, ++ccccccccccccccc) {} After: for (int aaaaaa = aaaaaaaaaa; aaaaaa < bbbbbbbb; ++aaaaaa, ++ccccccccccccccc) {} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174308 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-04Restructuring of token annotation for formatting.Daniel Jasper
This combines several changes: * Calculation token type (e.g. for * and &) in the AnnotatingParser. * Calculate the scope binding strength in the AnnotatingParser. * Let <> and [] scopes bind stronger than () and {} scopes. * Add minimal debugging output. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174307 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-03Fix bug in formatting of nested initializers.Daniel Jasper
We can now format: SomeArrayOfSomeType a = { { { 1, 2, 3 } }, { { 1, 2, 3 } }, { { 111111111111111111111111111111, 222222222222222222222222222222, 333333333333333333333333333333 } }, { { 1, 2, 3 } }, { { 1, 2, 3 } } }; Before, we did strange things there. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174291 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-31Never break inside something that was a preprocessor directive.Manuel Klimek
Just put it in one unwrapped line and let the formatter handle it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174063 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-31Several improvements to the formatting of static initializers.Daniel Jasper
1. Never avoid bin packing in static initializers as this can lead to terrible results. 2. If an element has to be broken over multiple lines, break after the following comma. This should be a step forward, but there are still many cases especially with nested static initializers that we handle badly. More patches will follow. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174061 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-30Don't generate no-op replacements.Daniel Jasper
No functional changes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173916 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-29Improve formatting of code with comments.Daniel Jasper
Before: aaaaaaa(aaaaaa( // comment aaaaaaa)); <big mess> After: aaaaaaa(aaaaaa( // comment aaaaaaaa)); function(/* parameter 1 */ aaaaaaa, /* parameter 2 */ aaaaaaa, /* parameter 3 */ aaaaaaa, /* parameter 4 */ aaaaaaa); (the latter example was only wrong in the one-arg-per-line mode, e.g. in Google style). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173821 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-29Allow all parameters on next line for function calls in Chrome.Daniel Jasper
The style guide only forbids this for function declarations. So, now someFunction( aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaa, aaaaaaaaaaaa); Is allowed in Chromium mode. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173806 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-29Initial support for multiple variable declarations.Daniel Jasper
Before: SomeType aaaaaaaaaaaaaaaaa = aaaaaa->aaaaaaaaaaaaaaaaa(), aaaaaaaaaaa = aaaaaa->aaaaaaaaaaa(); After: SomeType aaaaaaaaaaaaaaaaa = aaaaaa->aaaaaaaaaaaaaaaaa(), aaaaaaaaaaa = aaaaaa->aaaaaaaaaaa(); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173792 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-29Reverting changes from r173785 (removing empty lines before "}").Daniel Jasper
This needs some more thinking, e.g. for namespaces, chains of if-else if, ... git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173787 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-29Remove empty lines before "}".Daniel Jasper
Those empty lines waste vertical whitespace and almost never increase readability. Before: void f() { DoSomething(); } After: void f() { DoSomething(); } git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173785 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-28Fix a bug that would lead to bad line break decisions in for loops.Daniel Jasper
Before: for (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaa = aaaaaaaaaaaaaaa .aaaaaaaaaaaaaaaa; aaaaaaaaaaa != aaaaaaaaaaaaaaaaaaa; ++aaaaaaaaaaa) {} After: for (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaa = aaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaa; aaaaaaaaaaa != aaaaaaaaaaaaaaaaaaa; ++aaaaaaaaaaa) {} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173695 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-28Don't put a function's return type on its own line in Google style.Daniel Jasper
This would be against the style guide: http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Function_Declarations_and_Definitions#Function_Declarations_and_Definitions Not sure what to do as a last resort if the function signature does not fit onto a single line in Google style .. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173690 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-28Let clang-format break after a function's return type.Daniel Jasper
Before: TypeSpecDecl *TypeSpecDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *II, Type *T) {} After: TypeSpecDecl * TypeSpecDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *II, Type *T) {} This fixes llvm.org/PR14717. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173688 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-28Make continuations in constructor initializers consistent.Daniel Jasper
Before: Constructor : LooooooooooooooooooooongVariable( LooooooooooooooooooooongValue) {} After: Constructor : LooooooooooooooooooooongVariable( LooooooooooooooooooooongValue) {} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173685 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-28Initial support for formatting range-based for-loops.Daniel Jasper
Before (in good cases): for (auto aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa : aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {} for (auto aaaaaaaaaaaaaaaaaaaa : aaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaa, aaaa)) {} After: for (auto aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa : aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {} for (auto aaaaaaaaaaaaaaaaaaaa : aaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaa, aaaa)) {} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173684 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-28Improve formatting of conditional expressions.Daniel Jasper
Before we did not really systematically format those. Now, we format the different cases as: - 1 Line: a ? b : c; - 2 Lines: short ? loooooooooong : loooooooooong - 2 Lines: loooooooooooooooong ? short : short - 3 Lines: loooooooooooooooong ? loooooooooooooong : loooooooooooooong Not sure whether "?" and ":" should go on the new line, but it seems to be the most consistent approach. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173683 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-28Several small changes in formatting decisions.Daniel Jasper
1. Use a hanging ident for function calls nested in binary expressions. E.g.: int aaaaa = aaaaaaaaa && aaaaaaaaaa( aaaaaaaaaa); 2. Slightly improve heuristic for builder type expressions and reduce penalty for breaking before "." and "->" in those. 3. Remove mostly obsolete metric of decreasing indent level. This fixes: llvm.org/PR14931. Changes #1 and #2 were necessary to keep tests passing after #3. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173680 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-28Improve indentation after breaking at nested name specifiers.Daniel Jasper
These always represent a continuation and we should increase the ident. Before: aaaaaaaaa(aaaaaaaaaaaaaaaaaaaaa:: aaaaaaaaaaaaaaaaaaaa); After: aaaaaaaaa(aaaaaaaaaaaaaaaaaaaaa:: aaaaaaaaaaaaaaaaaaaa); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173675 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-28Avoid confusing identations for multi-parameter functions.Daniel Jasper
Before: aaaaaaaa(aaaaaaaaa( aaaaaaaaaa(), aaaaaaaaa); After: aaaaaaaa(aaaaaaaaa( aaaaaaaaaa(), aaaaaaaaa); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173673 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25Fix some alignment and line break decisions.Daniel Jasper
This combines two small changes: 1) Put a penalty on breaking after "<" 2) Only produce a hanging indent when parameters are separated by commas. Before: aaaaaaaaaaaaaaaaaaaaaaaa< aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaa>(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); aaaaaa(new Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaa)); After: aaaaaaaaaaaaaaaaaaaaaaaa<aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaa>( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); aaaaaa(new Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaa)); This changes one ObjC test, but AFAICT this is not according to any style guide (neither before nor after). We probably should be aligning on the ":" there according to: http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml?showone=Method_Invocations#Method_Invocations git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173457 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25Allow breaking after "::" if absolutely necessary.Daniel Jasper
Otherwise, really long nested name specifiers can easily lead to a violation of the column limit. Not sure about the rules for indentation in those cases, so input is appreciated (see tests.). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173438 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23Add extra indent for nested calls inside if's.Daniel Jasper
Before: if (aaaaaaaaaa( aaaaaaaaaa)) {} After: if (aaaaaaaaaa( aaaaaaaaaa)) {} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173290 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23Don't try to align builder-type continuations on assignments.Daniel Jasper
Before: int aaaa = aaaaa().aaaaa() // force break .aaaaa(); After: int aaaa = aaaaa().aaaaa() // force break .aaaaa(); The other indent is just wrong and confusing. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173273 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23Don't try to do a hanging ident after assignments.Daniel Jasper
Before: bool aaaa = aaaaaaaaaaa( aaaaaaaaaaaaaaaaa); After: bool aaaa = aaaaaaaaaaa( aaaaaaaaaaaaaaaaa); The other indentation was a nice attempt but doesn't work in many cases. Not sure what the right long term solution is as the "After: " is still not nice. We either need to figure out what to do in the cases where it "doesn't work" or come up with a third solution, e.g. falling back to: bool aaaa = aaaaaaaaaaa( aaaaaaaaaaaaaaaaa); which should always work and nicely highlight the structure. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173268 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23Fix handling of macro definitions.Manuel Klimek
Now correctly formats: #define A (1) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173264 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23Fixes layouting regression and invalid-read.Manuel Klimek
Layouting would prevent breaking before + in a[b + c] = d; Regression detected by code review. Also fixes an invalid-read found by the valgrind bot. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173262 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23Fix the formatting of pointer/reference types in range-based for loops.Daniel Jasper
Before: for (int & a : Values) {} After: for (int &a : Values) {} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173259 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23Removing the penalty for breaking after "=".Daniel Jasper
Having seen more cases, this actually was not a good thing to do in the first place. We can still improve on what we do now, but breaking after the "=" is good in many cases. Before: aaaaaaaaaaaaa = aa->aaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaa)); After: aaaaaaaaaaaaa = aa->aaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaa)); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173257 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23Fix another regression for pointer types.Daniel Jasper
Before: if (int * a = &b) ... After: if (int *a = &b) ... Also changed all the existing tests to test the expressions in question both in a declaration and in an expression context. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173256 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23Fix regression in formatting pointer types.Daniel Jasper
We will need a more principled solution, but we should not leave this unfixed until we come up with one. Before: void f() { int * a; } After: void f() { int *a; } git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173252 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23Fixes incorrect handling of the declaration context stack.Manuel Klimek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173250 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23Fix segfaults in the formatter.Manuel Klimek
Also: expletive deleted. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173247 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23Add option to allow putting all parameters onto the next line.Daniel Jasper
This only affects styles where BinPackParameters is false. With AllowAllParametersOnNextLine: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaa, aaaaaaaaaa, aaaaaaaaaa, aaaaaaaaaaa, aaaaaaaaaaa); Without it: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaa, aaaaaaaaaa, aaaaaaaaaa, aaaaaaaaaaa, aaaaaaaaaaa); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173246 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23Allow us to better guess the context of an unwrapped line.Manuel Klimek
This gives us the ability to guess better defaults for whether a * between identifiers is a pointer dereference or binary operator. Now correctly formats: void f(a *b); void f() { f(a * b); } git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173243 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-22Formatter: Remove a fixme klimek fixed in r173168.Nico Weber
Add a few comments to the ObjC test cases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173169 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-22Implements more principled comment parsing.Manuel Klimek
Changing nextToken() in the UnwrappedLineParser to get the next non-comment token. This allows us to correctly layout a whole class of snippets, like: if /* */(/* */ a /* */) /* */ f() /* */; /* */ else /* */ g(); Fixes a bug in the formatter where we would assume there is a previous non-comment token. Also adds the indent level of an unwrapped line to the debug output in the parser. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173168 91177308-0d34-0410-b5e6-96231b3b80d8