#
94f0e138 |
| 06-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Align trailing block comments like trailing line comments.
llvm-svn: 174537
|
#
c485b4e5 |
| 06-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Fix formatting of ObjC method calls.
This fixes llvm.org/PR15165.
We now correctly align: [image_rep drawInRect:drawRect fromRect:NSZeroRect operation:NSCompositeCopy
Fix formatting of ObjC method calls.
This fixes llvm.org/PR15165.
We now correctly align: [image_rep drawInRect:drawRect fromRect:NSZeroRect operation:NSCompositeCopy fraction:1.0 ssssssssdd:NO hints:nil];
llvm-svn: 174513
show more ...
|
#
38396591 |
| 06-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Fix a formatting bug caused by comments in expressions.
This fixes llvm.org/PR15162.
Before: bool aaaaaaaaaaaaa = // comment aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa || aaaaaaaaaaaaaaaaaaaaaaaaa
Fix a formatting bug caused by comments in expressions.
This fixes llvm.org/PR15162.
Before: bool aaaaaaaaaaaaa = // comment aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa || aaaaaaaaaaaaaaaaaaaaaaaaaaaa || aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa || aaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
After: bool aaaaaaaaaaaaa = // comment aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa || aaaaaaaaaaaaaaaaaaaaaaaaaaaa || aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa || aaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
llvm-svn: 174508
show more ...
|
#
7fce3ab0 |
| 06-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Optionally derive formatting information from the input file.
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 co
Optionally derive formatting information from the input file.
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.
llvm-svn: 174504
show more ...
|
#
1ac3e05b |
| 05-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Initial support for formatting ObjC method declarations/calls.
We can now format stuff like: - (void)doSomethingWith:(GTMFoo *)theFoo rect:(NSRect)theRect interval:
Initial support for formatting ObjC method declarations/calls.
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.
llvm-svn: 174364
show more ...
|
#
b9ebd5d3 |
| 05-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Fix some linebreak decisions in Google format.
Before: f(aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaa); aaaaaaa(aaaaaaaaaaaaa, aaaaaaaaaaaaa, aaaaaaaaaaa
Fix some linebreak decisions in Google format.
Before: f(aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaa); aaaaaaa(aaaaaaaaaaaaa, aaaaaaaaaaaaa, aaaaaaaaaaaaa(aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaa));
After: f(aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaa); aaaaaaa(aaaaaaaaaaaaa, aaaaaaaaaaaaa, aaaaaaaaaaaaa(aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaa));
llvm-svn: 174363
show more ...
|
#
14e40ec8 |
| 04-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Improve handling of trailing block comments
This is a follow up to r174309 to actually make it work.
llvm-svn: 174314
|
#
1f140981 |
| 04-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Improve handling of trailing block comments.
We can now (even in non-bin-packing modes) format: someFunction(1, /* comment 1 */ 2, /* comment 2 */ 3, /* comment 3 */
Improve handling of trailing block comments.
We can now (even in non-bin-packing modes) format: someFunction(1, /* comment 1 */ 2, /* comment 2 */ 3, /* comment 3 */ aaa);
llvm-svn: 174309
show more ...
|
#
f7f13c0e |
| 04-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Fix an error in formatting of for-loops.
Two minor changes: * Slight penalty for breaking at "," as opposed to ";". * Don't apply bin-packing rules to for-loops.
Before: for (int aaaaaa = aaaaaaaaa
Fix an error in formatting of for-loops.
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) {}
llvm-svn: 174308
show more ...
|
#
3a9370cb |
| 04-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Restructuring of token annotation for formatting.
This combines several changes: * Calculation token type (e.g. for * and &) in the AnnotatingParser. * Calculate the scope binding strength in the An
Restructuring of token annotation for formatting.
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.
llvm-svn: 174307
show more ...
|
#
1ca05ccf |
| 03-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Fix bug in formatting of nested initializers.
We can now format: SomeArrayOfSomeType a = { { { 1, 2, 3 } }, { { 1, 2, 3 } }, { { 111111111111111111111111111111,
Fix bug in formatting of nested initializers.
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.
llvm-svn: 174291
show more ...
|
#
83d4e783 |
| 01-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Hopefully fix windows build due to non-standard pair implementation.
llvm-svn: 174169
|
#
4b866274 |
| 01-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Revamp of the basic layouting algorithm in clang-format.
In order to end up with good solutions, clang-format needs to try "all" combinations of line breaks, evaluate them and select the best one. B
Revamp of the basic layouting algorithm in clang-format.
In order to end up with good solutions, clang-format needs to try "all" combinations of line breaks, evaluate them and select the best one. Before, we have done this using a DFS with memoization and cut-off conditions. However, this approach is very limited as shown by the huge static initializer in the attachment of llvm.org/PR14959.
Instead, this new implementation uses a variant of Dijkstra's algorithm to do a prioritized BFS over the solution space.
Some numbers: lib/Format/TokenAnnotator.cpp: 1.5s -> 0.15s Attachment of PR14959: 10min+ (didn't finish) -> 10s
No functional changes intended.
llvm-svn: 174166
show more ...
|
#
8a8ce240 |
| 31-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Several improvements to the formatting of static initializers.
1. Never avoid bin packing in static initializers as this can lead to terrible results. 2. If an element has to be broken over multi
Several improvements to the formatting of static initializers.
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.
llvm-svn: 174061
show more ...
|
#
7b038a23 |
| 30-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Don't generate no-op replacements.
No functional changes.
llvm-svn: 173916
|
#
7a6d09b3 |
| 29-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Move the token annotator into separate files.
No functional changes. Also removed experimental-warning from all of clang-format's files, as it is no longer accurate.
llvm-svn: 173830
|
#
ddaa9be9 |
| 29-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Improve formatting of code with comments.
Before: aaaaaaa(aaaaaa( // comment aaaaaaa)); <big mess>
After: aaaaaaa(aaaaaa( // comment aaaaaaaa)); function(/* parameter 1 */ aaaaa
Improve formatting of code with comments.
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).
llvm-svn: 173821
show more ...
|
#
f7db433e |
| 29-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Allow all parameters on next line for function calls in Chrome.
The style guide only forbids this for function declarations. So, now
someFunction( aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaa, aaaaa
Allow all parameters on next line for function calls in Chrome.
The style guide only forbids this for function declarations. So, now
someFunction( aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaa, aaaaaaaaaaaa);
Is allowed in Chromium mode.
llvm-svn: 173806
show more ...
|
#
17fdaa40 |
| 29-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Split ">>" in "A<B<C> >" in Chromium style.
It needs to be compatible with C++03.
llvm-svn: 173805
|
#
85f16f94 |
| 29-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Fix uninitialized error caused by r173801.
llvm-svn: 173803
|
#
cf330001 |
| 29-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Calculate the split penalty upfront.
This is a) More efficient. b) Important as we move forward with further metrics for penalty.
No functional changes intended.
llvm-svn: 173801
|
#
bbc8415f |
| 29-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Fix a comment and reformat clang-format with clang-format
Not all changes might be ideal, but IMO all are acceptable.
llvm-svn: 173793
|
#
38c11ce9 |
| 29-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Initial support for multiple variable declarations.
Before: SomeType aaaaaaaaaaaaaaaaa = aaaaaa->aaaaaaaaaaaaaaaaa(), aaaaaaaaaaa = aaaaaa->aaaaaaaaaaa(); After: SomeType aaaaaaaaaaaaaaaaa
Initial support for multiple variable declarations.
Before: SomeType aaaaaaaaaaaaaaaaa = aaaaaa->aaaaaaaaaaaaaaaaa(), aaaaaaaaaaa = aaaaaa->aaaaaaaaaaa(); After: SomeType aaaaaaaaaaaaaaaaa = aaaaaa->aaaaaaaaaaaaaaaaa(), aaaaaaaaaaa = aaaaaa->aaaaaaaaaaa();
llvm-svn: 173792
show more ...
|
#
6a217e18 |
| 29-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Reverting changes from r173785 (removing empty lines before "}").
This needs some more thinking, e.g. for namespaces, chains of if-else if, ...
llvm-svn: 173787
|
#
aa94a90a |
| 29-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Remove empty lines before "}".
Those empty lines waste vertical whitespace and almost never increase readability.
Before: void f() { DoSomething();
}
After: void f() { DoSomething(); }
llvm-
Remove empty lines before "}".
Those empty lines waste vertical whitespace and almost never increase readability.
Before: void f() { DoSomething();
}
After: void f() { DoSomething(); }
llvm-svn: 173785
show more ...
|