#
a5151271 |
| 12-Mar-2013 |
Alexander Kornienko <alexfh@google.com> |
Implemented formatting of rvalue references
Summary: Handle "&&" usage as rvalue reference, added tests and fixed incorrect tests that interfere with this feature.
http://llvm.org/bugs/show_bug.cgi
Implemented formatting of rvalue references
Summary: Handle "&&" usage as rvalue reference, added tests and fixed incorrect tests that interfere with this feature.
http://llvm.org/bugs/show_bug.cgi?id=15051
Reviewers: djasper
Reviewed By: djasper
CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D531
llvm-svn: 176874
show more ...
|
#
18104656 |
| 12-Mar-2013 |
Daniel Jasper <djasper@google.com> |
Remove bad space after "default".
Before: switch (x) { default : {} }
After: switch (x) { default: {} }
llvm-svn: 176861
|
#
5085d9b2 |
| 08-Mar-2013 |
Manuel Klimek <klimek@google.com> |
Fixes breaking of string literals.
1. We now ignore all non-default string literals, including raw literals. 2. We do not break inside escape sequences any more.
FIXME: We still break in trigraphs.
Fixes breaking of string literals.
1. We now ignore all non-default string literals, including raw literals. 2. We do not break inside escape sequences any more.
FIXME: We still break in trigraphs. llvm-svn: 176710
show more ...
|
#
f71cf3bd |
| 07-Mar-2013 |
Daniel Jasper <djasper@google.com> |
Remove unncessary whitespace when triggered on empty line.
With the cursor located at "I", clang-format would not do anything to:
int a;
I
int b;
With this patch, it reduces the number of e
Remove unncessary whitespace when triggered on empty line.
With the cursor located at "I", clang-format would not do anything to:
int a;
I
int b;
With this patch, it reduces the number of empty lines as necessary, and removes unnecessary whitespace. It does not change/reformat "int a;" or "int b;".
llvm-svn: 176650
show more ...
|
#
abf6e03b |
| 04-Mar-2013 |
Manuel Klimek <klimek@google.com> |
Make sure to not split string literals at the first character.
llvm-svn: 176447
|
#
973c9420 |
| 04-Mar-2013 |
Daniel Jasper <djasper@google.com> |
Format a line if a range in its leading whitespace was selected.
With [] marking the selected range, clang-format invoked on
[ ] int a;
Would so far not reformat anything. With this patch,
Format a line if a range in its leading whitespace was selected.
With [] marking the selected range, clang-format invoked on
[ ] int a;
Would so far not reformat anything. With this patch, it formats a line if its leading whitespace is touched.
llvm-svn: 176435
show more ...
|
#
a79064a8 |
| 01-Mar-2013 |
Daniel Jasper <djasper@google.com> |
Remove whitespace at end of file.
This fixes the rest of llvm.org/PR15062.
llvm-svn: 176361
|
#
8eb371b3 |
| 01-Mar-2013 |
Daniel Jasper <djasper@google.com> |
Correctly format arrays of pointers and function types.
Before: void f(Type(*parameter)[10]) {} int(*func)(void *);
After: void f(Type (*parameter)[10]) {} int (*func)(void *);
llvm-svn: 176356
|
#
f9a84b5f |
| 01-Mar-2013 |
Daniel Jasper <djasper@google.com> |
Normal indent for last element of builder-type call.
In builder type call, we indent to the laster function calls. However, for the last element of such a call, we don't need to do so, as that norma
Normal indent for last element of builder-type call.
In builder type call, we indent to the laster function calls. However, for the last element of such a call, we don't need to do so, as that normally just wastes space and does not increase readability.
Before: aaaaaa->aaaaaa->aaaaaa( // break aaaaaa); aaaaaaaaaaaaaaaaaaaaa->aaaaaaaaaaaaaaaaaaaaaa ->aaaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
After: aaaaaa->aaaaaa->aaaaaa( // break aaaaaa); aaaaaaaaaaaaaaaaaaaaa->aaaaaaaaaaaaaaaaaaaaaa->aaaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
llvm-svn: 176352
show more ...
|
#
3324cbef |
| 01-Mar-2013 |
Daniel Jasper <djasper@google.com> |
Remove trailing whitespace of line comments.
This fixed llvm.org/PR15378.
llvm-svn: 176351
|
#
e317d1b1 |
| 01-Mar-2013 |
Manuel Klimek <klimek@google.com> |
Implements breaking string literals at slashes.
We now break at a slash if we do not find a space to break on.
Also fixes a bug where we would go over the limit when breaking the second line.
llvm
Implements breaking string literals at slashes.
We now break at a slash if we do not find a space to break on.
Also fixes a bug where we would go over the limit when breaking the second line.
llvm-svn: 176350
show more ...
|
#
b176cff8 |
| 01-Mar-2013 |
Manuel Klimek <klimek@google.com> |
Implement fallback split point for string literals.
If we don't find a natural split point (currently space) in a string literal protruding over the line, we just split at the last possible point.
Implement fallback split point for string literals.
If we don't find a natural split point (currently space) in a string literal protruding over the line, we just split at the last possible point.
llvm-svn: 176349
show more ...
|
#
a400cab4 |
| 28-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Reduce penalty for splitting after "{" in static initializers.
This fixes llvm.org/PR15379.
Before: const uint8_t aaaaaaaaaaaaaaaaaaaaaa[0] = { 0x00, 0x00, 0x00, 0x00, 0x00,
Reduce penalty for splitting after "{" in static initializers.
This fixes llvm.org/PR15379.
Before: const uint8_t aaaaaaaaaaaaaaaaaaaaaa[0] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // comment 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // comment 0x00, 0x00, 0x00, 0x00 // comment };
After: const uint8_t aaaaaaaaaaaaaaaaaaaaaa[0] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // comment 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // comment 0x00, 0x00, 0x00, 0x00 // comment };
llvm-svn: 176262
show more ...
|
#
9a23be74 |
| 28-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Dont break between (( in __attribute__((.
Before: void aaaaaaaaaaaaaaaaaa() __attribute__( (aaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaa));
After: void a
Dont break between (( in __attribute__((.
Before: void aaaaaaaaaaaaaaaaaa() __attribute__( (aaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaa));
After: void aaaaaaaaaaaaaaaaaa() __attribute__((aaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaa));
llvm-svn: 176260
show more ...
|
#
ff6c3a95 |
| 28-Feb-2013 |
Daniel Jasper <djasper@google.com> |
No spaces around pointers to members.
Before: (a ->* f)() After: (a->*f)() llvm-svn: 176252
|
#
c22f5b4a |
| 28-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Improve formatting of #defines.
Two improvements: 1) Always leave at least one space before "\". Otherwise is can look bad and there is a risk of unwillingly joining to characters to a different
Improve formatting of #defines.
Two improvements: 1) Always leave at least one space before "\". Otherwise is can look bad and there is a risk of unwillingly joining to characters to a different token. 2) Use the full column limit for single-line #defines. Fixes llvm.org/PR15148
llvm-svn: 176245
show more ...
|
#
57d4a582 |
| 28-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Fix bug when formatting "A<A<A>>".
Before: A<A<A>> ReadKansas(int aaaaaaaaaaaaaaaaaaaaaaaaaaa, int aaaaaaaaaaaaaaaaaaaaaaa); Before: A<A<A>> ReadKansas(int aaaaaaaaaaaaaaaaaaaaa
Fix bug when formatting "A<A<A>>".
Before: A<A<A>> ReadKansas(int aaaaaaaaaaaaaaaaaaaaaaaaaaa, int aaaaaaaaaaaaaaaaaaaaaaa); Before: A<A<A>> ReadKansas(int aaaaaaaaaaaaaaaaaaaaaaaaaaa, int aaaaaaaaaaaaaaaaaaaaaaa);
llvm-svn: 176244
show more ...
|
#
ead41b6b |
| 28-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Fix incorrect recognition of bin-packing.
Before (in Google style): Constructor() : aaaaa(aaaaaa), aaaaa(aaaaaa), aaaaa(aaaaaa), aaaaa(aaaaaa), aaaaa( aaaaaa) {}
After: Constructor()
Fix incorrect recognition of bin-packing.
Before (in Google style): Constructor() : aaaaa(aaaaaa), aaaaa(aaaaaa), aaaaa(aaaaaa), aaaaa(aaaaaa), aaaaa( aaaaaa) {}
After: Constructor() : aaaaa(aaaaaa), aaaaa(aaaaaa), aaaaa(aaaaaa), aaaaa(aaaaaa), aaaaa(aaaaaa) {}
llvm-svn: 176242
show more ...
|
#
d8ffcfa9 |
| 28-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Fix spacing after binary operator as macro parameter.
Before: COMPARE(a, == , b); After: COMPARE(a, ==, b); llvm-svn: 176241
|
#
8e559271 |
| 27-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Fix formatting of multiplications in array subscripts.
Before: a[a* a] = 1;
After: a[a * a] = 1;
llvm-svn: 176180
|
#
2cf17bfc |
| 27-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Enable bin-packing in Google style.
After some discussions, it seems that this is the better path in the long run. Does not change Chromium style, as there, bin packing is forbidden by the style gui
Enable bin-packing in Google style.
After some discussions, it seems that this is the better path in the long run. Does not change Chromium style, as there, bin packing is forbidden by the style guide.
Also fix two minor bugs wrt. formatting: 1. If a call parameter is a function call itself and is split before the "." or "->", split before the next parameter. 2. If a call parameter is string literal that has to be split onto two lines, split before the next parameter.
llvm-svn: 176177
show more ...
|
#
70bc8742 |
| 26-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Fix bad line break decision.
Before: if (Intervals[i].getRange().getFirst() < Intervals[i - 1] .getRange().getLast()) {}
After: if (Intervals[i].getRang
Fix bad line break decision.
Before: if (Intervals[i].getRange().getFirst() < Intervals[i - 1] .getRange().getLast()) {}
After: if (Intervals[i].getRange().getFirst() < Intervals[i - 1].getRange().getLast()) {}
llvm-svn: 176092
show more ...
|
#
16b3562f |
| 26-Feb-2013 |
Daniel Jasper <djasper@google.com> |
In range-based for-loops, prefer splitting after ":".
Before: for (const aaaaaaaaaaaaaaaaaaaaa & aaaaaaaaa : aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}
After: for (const aaaaaaaaaaaaaaaaaaaaa &a
In range-based for-loops, prefer splitting after ":".
Before: for (const aaaaaaaaaaaaaaaaaaaaa & aaaaaaaaa : aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}
After: for (const aaaaaaaaaaaaaaaaaaaaa &aaaaaaaaa : aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}
llvm-svn: 176087
show more ...
|
#
fb5e2411 |
| 26-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Only keep empty lines in unwrapped lines if they preceed a line comment.
Empty lines followed by line comments are often used to highlight the comment. Empty lines somewhere else are usually left ov
Only keep empty lines in unwrapped lines if they preceed a line comment.
Empty lines followed by line comments are often used to highlight the comment. Empty lines somewhere else are usually left over from manual or automatic formatting and should probably be removed.
Before (clang-format would keep): S s = { a,
b };
After: S s = { a, b };
llvm-svn: 176086
show more ...
|
#
5497fce4 |
| 26-Feb-2013 |
Daniel Jasper <djasper@google.com> |
Only break string literals as a last resort.
We might want to move towards doing this if the formatting can be significantly improved, but we need to carefully evaluate the different situations firs
Only break string literals as a last resort.
We might want to move towards doing this if the formatting can be significantly improved, but we need to carefully evaluate the different situations first.
Before (the string literal was split by clang-format here): aaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaa, aaaaaa("aaa aaaaa aaa aaa aaaaa aaa " "aaaaa aaa aaa aaaaaa"));
After: aaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaa, aaaaaa("aaa aaaaa aaa aaa aaaaa aaa aaaaa aaa aaa aaaaaa"));
llvm-svn: 176084
show more ...
|