Revision tags: llvmorg-3.3.0 |
|
#
61a40782 |
| 06-Jun-2013 |
Daniel Jasper <djasper@google.com> |
Fix incorrect line breaking before trailing block comments.
Before, clang-format would happily move a trailing block comment to a new line, which normally changes the perceived binding of that comme
Fix incorrect line breaking before trailing block comments.
Before, clang-format would happily move a trailing block comment to a new line, which normally changes the perceived binding of that comment.
E.g., it would move: void f() { /* comment */ ... } to: void f() { /* comment */ ... }
llvm-svn: 183420
show more ...
|
#
6dcecb6b |
| 06-Jun-2013 |
Daniel Jasper <djasper@google.com> |
Fix clang-format's expression parser for leading }s.
The leading "}" in the construct "} else if (..) {" was confusing the expression parser. Thus, no fake parentheses were generated and the indenta
Fix clang-format's expression parser for leading }s.
The leading "}" in the construct "} else if (..) {" was confusing the expression parser. Thus, no fake parentheses were generated and the indentation was broken in some cases.
llvm-svn: 183393
show more ...
|
#
05866378 |
| 06-Jun-2013 |
Daniel Jasper <djasper@google.com> |
Improve c-style cast detection.
Before: return (my_int) aaaa; template <> void f<int>(int i)SOME_ANNOTATION; f("aaaa" SOME_MACRO(aaaa)"aaaa");
After: return (my_int)aaaa; template <> void f<int>(in
Improve c-style cast detection.
Before: return (my_int) aaaa; template <> void f<int>(int i)SOME_ANNOTATION; f("aaaa" SOME_MACRO(aaaa)"aaaa");
After: return (my_int)aaaa; template <> void f<int>(int i) SOME_ANNOTATION; f("aaaa" SOME_MACRO(aaaa) "aaaa");
llvm-svn: 183389
show more ...
|
#
5238eba7 |
| 06-Jun-2013 |
NAKAMURA Takumi <geek4civic@gmail.com> |
clang/unittests/Format/FormatTest.cpp: Suppress utf8 literals with _MSC_VER. MS cl.exe is unaware of BOM-less utf8 source files.
FIXME: Encode Cyrillic and CJK characters below to appease MS compile
clang/unittests/Format/FormatTest.cpp: Suppress utf8 literals with _MSC_VER. MS cl.exe is unaware of BOM-less utf8 source files.
FIXME: Encode Cyrillic and CJK characters below to appease MS compilers. llvm-svn: 183366
show more ...
|
#
ff73c20c |
| 05-Jun-2013 |
Alexander Kornienko <alexfh@google.com> |
Added test with characters using four bytes in UTF-8 representation.
llvm-svn: 183315
|
#
ffcc0107 |
| 05-Jun-2013 |
Alexander Kornienko <alexfh@google.com> |
UTF-8 support for clang-format.
Summary: Detect if the file is valid UTF-8, and if this is the case, count code points instead of just using number of bytes in all (hopefully) places, where number o
UTF-8 support for clang-format.
Summary: Detect if the file is valid UTF-8, and if this is the case, count code points instead of just using number of bytes in all (hopefully) places, where number of columns is needed. In particular, use the new FormatToken.CodePointCount instead of TokenLength where appropriate. Changed BreakableToken implementations to respect utf-8 character boundaries when in utf-8 mode.
Reviewers: klimek, djasper
Reviewed By: djasper
CC: cfe-commits, rsmith, gribozavr
Differential Revision: http://llvm-reviews.chandlerc.com/D918
llvm-svn: 183312
show more ...
|
Revision tags: llvmorg-3.3.0-rc3 |
|
#
1027c6e5 |
| 03-Jun-2013 |
Daniel Jasper <djasper@google.com> |
Let clang-format remove empty lines before "}".
These lines almost never aid readability.
Before: void f() { int i; // some variable
}
After: void f() { int i; // some variable }
llvm-svn:
Let clang-format remove empty lines before "}".
These lines almost never aid readability.
Before: void f() { int i; // some variable
}
After: void f() { int i; // some variable }
llvm-svn: 183112
show more ...
|
#
80503952 |
| 03-Jun-2013 |
Daniel Jasper <djasper@google.com> |
Improve detection preventing certain kind of formatting patterns.
An oversight in this detection made clang-format unable to format the following nicely: void aaaaaaaaaaaaaaaaaaa<aaaaaaaaaaaaaaaaaaa
Improve detection preventing certain kind of formatting patterns.
An oversight in this detection made clang-format unable to format the following nicely: void aaaaaaaaaaaaaaaaaaa<aaaaaaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbbbbbbbbbb>( cccccccccccccccccccccccccccc);
llvm-svn: 183097
show more ...
|
#
68d888cf |
| 03-Jun-2013 |
Daniel Jasper <djasper@google.com> |
Fix line-breaking problem caused by comment.
Before, clang-format would not find a solution for formatting: if ((aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa || bbbbbbbbbbbbbbbbbb) && // aaaaaaaaaaaaaaaa
Fix line-breaking problem caused by comment.
Before, clang-format would not find a solution for formatting: if ((aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa || bbbbbbbbbbbbbbbbbb) && // aaaaaaaaaaaaaaaa cccccc) { }
llvm-svn: 183096
show more ...
|
#
d589391d |
| 01-Jun-2013 |
Daniel Jasper <djasper@google.com> |
Improve recognition of template parameters.
Before: return a<b &&c> d; After: return a < b && c > d; llvm-svn: 183077
|
#
da6f225e |
| 31-May-2013 |
Daniel Jasper <djasper@google.com> |
Improve clang-format's c-style cast detection.
Before: x[(uint8) y]; x = (uint8) y; void f() { x = (uint8) y; } #define AA(X) sizeof(((X *) NULL)->a)
After: x[(uint8)y]; x = (uint8)y;
Improve clang-format's c-style cast detection.
Before: x[(uint8) y]; x = (uint8) y; void f() { x = (uint8) y; } #define AA(X) sizeof(((X *) NULL)->a)
After: x[(uint8)y]; x = (uint8)y; void f() { x = (uint8)y; } #define AA(X) sizeof(((X *)NULL)->a)
llvm-svn: 183014
show more ...
|
#
393564fd |
| 31-May-2013 |
Daniel Jasper <djasper@google.com> |
Improve clang-format's error recovery.
If a "}" is found inside parenthesis, this is probably a case of missing parenthesis. This enables continuing to format after stuff code like:
class A { voi
Improve clang-format's error recovery.
If a "}" is found inside parenthesis, this is probably a case of missing parenthesis. This enables continuing to format after stuff code like:
class A { void f( }; ..
llvm-svn: 183009
show more ...
|
#
a9eb2aaf |
| 31-May-2013 |
Daniel Jasper <djasper@google.com> |
Make formatting of empty blocks more consistent.
With this patch, the simplified rule is: If the block is part of a declaration (class, namespace, function, enum, ..), merge an empty block onto a si
Make formatting of empty blocks more consistent.
With this patch, the simplified rule is: If the block is part of a declaration (class, namespace, function, enum, ..), merge an empty block onto a single line. Otherwise (specifically for the compound statements of if, for, while, ...), keep the braces on two separate lines.
The reasons are: - Mostly the formatting of empty blocks does not matter much. - Empty compound statements are really rare and are usually just inserted while still working on the code. If they are on two lines, inserting code is easier. Also, overlooking the "{}" of an "if (...) {}" can be really bad. - Empty declarations are not uncommon, e.g. empty constructors. Putting them on one line saves vertical space at no loss of readability.
llvm-svn: 183008
show more ...
|
#
2c611c03 |
| 31-May-2013 |
Daniel Jasper <djasper@google.com> |
Properly format nested conditional operators.
Before: bool aaaaaa = aaaaaaaaaaaaa // ? aaaaaaaaaaaaaaa : bbbbbbbbbbbbbbb // ? ccccccccccccccc
Properly format nested conditional operators.
Before: bool aaaaaa = aaaaaaaaaaaaa // ? aaaaaaaaaaaaaaa : bbbbbbbbbbbbbbb // ? ccccccccccccccc : ddddddddddddddd;
After: bool aaaaaa = aaaaaaaaaaaaa // ? aaaaaaaaaaaaaaa : bbbbbbbbbbbbbbb // ? ccccccccccccccc : ddddddddddddddd;
llvm-svn: 183007
show more ...
|
#
5648cb32 |
| 31-May-2013 |
Daniel Jasper <djasper@google.com> |
Fix detection/formatting of braced lists in ternary expressions.
Before: foo = aaaaaaaaaaa ? vector<int> { aaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa, aaaaa } : vector<int>{ bbbbbbbbbbbbbbb
Fix detection/formatting of braced lists in ternary expressions.
Before: foo = aaaaaaaaaaa ? vector<int> { aaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa, aaaaa } : vector<int>{ bbbbbbbbbbbbbbbbbbbbbbbbbbb, bbbbbbbbbbbbbbbbbbbb, bbbbb };
After: foo = aaaaaaaaaaa ? vector<int>{ aaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa, aaaaa } : vector<int>{ bbbbbbbbbbbbbbbbbbbbbbbbbbb, bbbbbbbbbbbbbbbbbbbb, bbbbb };
llvm-svn: 182992
show more ...
|
#
ce257f29 |
| 30-May-2013 |
Daniel Jasper <djasper@google.com> |
More fixes for clang-format's multiline comment breaking.
llvm-svn: 182940
|
#
58dd2f06 |
| 30-May-2013 |
Daniel Jasper <djasper@google.com> |
Fix another clang-format crasher related to multi-line comments.
This fixes: /* * * something long going over the column limit. */
llvm-svn: 182932
|
#
51fb2b21 |
| 30-May-2013 |
Daniel Jasper <djasper@google.com> |
Fix crasher when formatting certain block comments.
Smallest reproduction: /* ** */
llvm-svn: 182913
|
#
ae1fbfb7 |
| 29-May-2013 |
Manuel Klimek <klimek@google.com> |
Fixes error when splitting block comments.
When trying to fall back to search from the end onwards, we would still find leading whitespace if the leading whitespace went on after the end of the line
Fixes error when splitting block comments.
When trying to fall back to search from the end onwards, we would still find leading whitespace if the leading whitespace went on after the end of the line.
llvm-svn: 182886
show more ...
|
#
41a0f78d |
| 29-May-2013 |
Daniel Jasper <djasper@google.com> |
Add return missing in r182855.
llvm-svn: 182856
|
#
40e1921f |
| 29-May-2013 |
Daniel Jasper <djasper@google.com> |
Leave some macros on their own line
If an identifier is on its own line and it is all upper case, it is highly likely that this is a macro that is meant to stand on a line by itself.
Before: class
Leave some macros on their own line
If an identifier is on its own line and it is all upper case, it is highly likely that this is a macro that is meant to stand on a line by itself.
Before: class A : public QObject { Q_OBJECT A() {} };
Ater: class A : public QObject { Q_OBJECT
A() {} };
llvm-svn: 182855
show more ...
|
#
61e6bbf8 |
| 29-May-2013 |
Daniel Jasper <djasper@google.com> |
Add option to always break template declarations.
With option enabled (e.g. in Google-style): template <typename T> void f() {}
With option disabled: template <typename T> void f() {}
Enabling thi
Add option to always break template declarations.
With option enabled (e.g. in Google-style): template <typename T> void f() {}
With option disabled: template <typename T> void f() {}
Enabling this for Google-style and Chromium-style, not sure which other styles would prefer that.
llvm-svn: 182849
show more ...
|
#
1ec31065 |
| 28-May-2013 |
Daniel Jasper <djasper@google.com> |
Support uniform inits in braced lists.
This made it necessary to remove an error detection which would let us bail out of braced lists in certain situations of missing "}". However, as we always ent
Support uniform inits in braced lists.
This made it necessary to remove an error detection which would let us bail out of braced lists in certain situations of missing "}". However, as we always entirely escape from the braced list on finding ";", this should not be a big problem.
With this, we can no format braced lists with uniformat inits:
return { arg1, SomeType { parameter } };
llvm-svn: 182788
show more ...
|
#
4d03d3b3 |
| 28-May-2013 |
Daniel Jasper <djasper@google.com> |
Fix formatting regression regarding pointers to arrays.
Before: f( (*PointerToArray)[10]); After: f((*PointerToArray)[10]);
This fixes llvm.org/PR16163
llvm-svn: 182777
|
#
bca4bbe3 |
| 28-May-2013 |
Daniel Jasper <djasper@google.com> |
Initial support for designated initializers.
llvm-svn: 182767
|