#
48c62f98 |
| 28-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Fix a bug that would lead to bad line break decisions in for loops.
Before: for (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaa = aaaaaaaaaaaaaaa .aaaaaaaaaaaaaaaa; aaaaaa
Fix a bug that would lead to bad line break decisions in for loops.
Before: for (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaa = aaaaaaaaaaaaaaa .aaaaaaaaaaaaaaaa; aaaaaaaaaaa != aaaaaaaaaaaaaaaaaaa; ++aaaaaaaaaaa) {}
After: for (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaa = aaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaa; aaaaaaaaaaa != aaaaaaaaaaaaaaaaaaa; ++aaaaaaaaaaa) {}
llvm-svn: 173695
show more ...
|
#
d36ef5e4 |
| 28-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Don't put a function's return type on its own line in Google style.
This would be against the style guide: http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Function_Declaration
Don't put a function's return type on its own line in Google style.
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 ..
llvm-svn: 173690
show more ...
|
#
d2639ef5 |
| 28-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Let clang-format break after a function's return type.
Before: TypeSpecDecl *TypeSpecDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo
Let clang-format break after a function's return type.
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.
llvm-svn: 173688
show more ...
|
#
65585ed8 |
| 28-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Make continuations in constructor initializers consistent.
Before: Constructor : LooooooooooooooooooooongVariable( LooooooooooooooooooooongValue) {}
After: Constructor : Loooooooooo
Make continuations in constructor initializers consistent.
Before: Constructor : LooooooooooooooooooooongVariable( LooooooooooooooooooooongValue) {}
After: Constructor : LooooooooooooooooooooongVariable( LooooooooooooooooooooongValue) {}
llvm-svn: 173685
show more ...
|
#
0b41cbb5 |
| 28-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Initial support for formatting range-based for-loops.
Before (in good cases): for (auto aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa : aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {} for (auto aaaa
Initial support for formatting range-based for-loops.
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)) {}
llvm-svn: 173684
show more ...
|
#
ca6623b9 |
| 28-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Improve formatting of conditional expressions.
Before we did not really systematically format those. Now, we format the different cases as:
- 1 Line: a ? b : c; - 2 Lines: short ? loooooooooong
Improve formatting of conditional expressions.
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.
llvm-svn: 173683
show more ...
|
#
20b09efa |
| 28-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Several small changes in formatting decisions.
1. Use a hanging ident for function calls nested in binary expressions. E.g.: int aaaaa = aaaaaaaaa && aaaaaaaaaa(
Several small changes in formatting decisions.
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.
llvm-svn: 173680
show more ...
|
#
4ad42359 |
| 28-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Improve indentation after breaking at nested name specifiers.
These always represent a continuation and we should increase the ident.
Before: aaaaaaaaa(aaaaaaaaaaaaaaaaaaaaa:: aaaaaaaaaaa
Improve indentation after breaking at nested name specifiers.
These always represent a continuation and we should increase the ident.
Before: aaaaaaaaa(aaaaaaaaaaaaaaaaaaaaa:: aaaaaaaaaaaaaaaaaaaa);
After: aaaaaaaaa(aaaaaaaaaaaaaaaaaaaaa:: aaaaaaaaaaaaaaaaaaaa);
llvm-svn: 173675
show more ...
|
#
7b5773e9 |
| 28-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Avoid confusing identations for multi-parameter functions.
Before: aaaaaaaa(aaaaaaaaa( aaaaaaaaaa(), aaaaaaaaa);
After: aaaaaaaa(aaaaaaaaa( aaaaaaaaaa(), aaaaaaaa
Avoid confusing identations for multi-parameter functions.
Before: aaaaaaaa(aaaaaaaaa( aaaaaaaaaa(), aaaaaaaaa);
After: aaaaaaaa(aaaaaaaaa( aaaaaaaaaa(), aaaaaaaaa);
llvm-svn: 173673
show more ...
|
#
7a31af14 |
| 25-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Fix some alignment and line break decisions.
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
Fix some alignment and line break decisions.
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
llvm-svn: 173457
show more ...
|
#
45797021 |
| 25-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Allow breaking after "::" if absolutely necessary.
Otherwise, really long nested name specifiers can easily lead to a violation of the column limit.
Not sure about the rules for indentation in thos
Allow breaking after "::" if absolutely necessary.
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.).
llvm-svn: 173438
show more ...
|
#
39e2738c |
| 23-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Add extra indent for nested calls inside if's.
Before: if (aaaaaaaaaa( aaaaaaaaaa)) {}
After: if (aaaaaaaaaa( aaaaaaaaaa)) {}
llvm-svn: 173290
|
#
a836b90a |
| 23-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Don't try to align builder-type continuations on assignments.
Before: int aaaa = aaaaa().aaaaa() // force break .aaaaa(); After: int aaaa = aaaaa().aaaaa() // force break .aaaaa();
T
Don't try to align builder-type continuations on assignments.
Before: int aaaa = aaaaa().aaaaa() // force break .aaaaa(); After: int aaaa = aaaaa().aaaaa() // force break .aaaaa();
The other indent is just wrong and confusing.
llvm-svn: 173273
show more ...
|
#
1565eb3e |
| 23-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Don't try to do a hanging ident after assignments.
Before: bool aaaa = aaaaaaaaaaa( aaaaaaaaaaaaaaaaa);
After: bool aaaa = aaaaaaaaaaa( aaaaaaaaaaaaaaaaa);
The other indentatio
Don't try to do a hanging ident after assignments.
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.
llvm-svn: 173268
show more ...
|
#
c1237a8b |
| 23-Jan-2013 |
Manuel Klimek <klimek@google.com> |
Fixes layouting regression and invalid-read.
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.
ll
Fixes layouting regression and invalid-read.
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.
llvm-svn: 173262
show more ...
|
#
420d7d33 |
| 23-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Fix the formatting of pointer/reference types in range-based for loops.
Before: for (int & a : Values) {} After: for (int &a : Values) {} llvm-svn: 173259
|
#
43b6548c |
| 23-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Removing the penalty for breaking after "=".
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 "=" i
Removing the penalty for breaking after "=".
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));
llvm-svn: 173257
show more ...
|
#
5b49f478 |
| 23-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Fix another regression for pointer types.
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 an
Fix another regression for pointer types.
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.
llvm-svn: 173256
show more ...
|
#
b9c0908f |
| 23-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Fix regression in formatting pointer types.
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() {
Fix regression in formatting pointer types.
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; } llvm-svn: 173252
show more ...
|
#
d33516ef |
| 23-Jan-2013 |
Manuel Klimek <klimek@google.com> |
Fix segfaults in the formatter.
Also: expletive deleted. llvm-svn: 173247
|
#
e941b169 |
| 23-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Add option to allow putting all parameters onto the next line.
This only affects styles where BinPackParameters is false.
With AllowAllParametersOnNextLine: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Add option to allow putting all parameters onto the next line.
This only affects styles where BinPackParameters is false.
With AllowAllParametersOnNextLine: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaa, aaaaaaaaaa, aaaaaaaaaa, aaaaaaaaaaa, aaaaaaaaaaa);
Without it: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaa, aaaaaaaaaa, aaaaaaaaaa, aaaaaaaaaaa, aaaaaaaaaaa);
llvm-svn: 173246
show more ...
|
#
0a3a3c99 |
| 23-Jan-2013 |
Manuel Klimek <klimek@google.com> |
Allow us to better guess the context of an unwrapped line.
This gives us the ability to guess better defaults for whether a * between identifiers is a pointer dereference or binary operator.
Now co
Allow us to better guess the context of an unwrapped line.
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); }
llvm-svn: 173243
show more ...
|
#
f92f7bc5 |
| 22-Jan-2013 |
Manuel Klimek <klimek@google.com> |
Implements more principled comment parsing.
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
Implements more principled comment parsing.
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.
llvm-svn: 173168
show more ...
|
#
50e7ab71 |
| 22-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Let the formatter be more restrictive for breaking around . and ->
Before: aaaaaaaaaaaaaaa(aaaaaaaaa, aaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaa) .aaaaaaaaaaaaaaaaaa();
After: aaaaaaaaaaaaaaa(aaaaaaaaa
Let the formatter be more restrictive for breaking around . and ->
Before: aaaaaaaaaaaaaaa(aaaaaaaaa, aaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaa) .aaaaaaaaaaaaaaaaaa();
After: aaaaaaaaaaaaaaa(aaaaaaaaa, aaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaa).aaaaaaaaaaaaaaaaaa();
llvm-svn: 173160
show more ...
|
#
0b820602 |
| 22-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Fix "*" formatting when creating arrays of pointers.
Before: A = new int * [10](); After: A = new int *[10](); llvm-svn: 173150
|