#
e3648fbe |
| 02-Sep-2013 |
Alexander Kornienko <alexfh@google.com> |
Added WebKit style to the BasedOnStyle handling and to the relevant help messages.
llvm-svn: 189765
|
#
632abb9b |
| 02-Sep-2013 |
Alexander Kornienko <alexfh@google.com> |
Store first and last newline position in the token text for string literals and comments.
Summary: Store first and last newline position in the token text for string literals and comments to avoid d
Store first and last newline position in the token text for string literals and comments.
Summary: Store first and last newline position in the token text for string literals and comments to avoid doing .find('\n') for each possible solution.
Reviewers: djasper
Reviewed By: djasper
CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D1556
llvm-svn: 189758
show more ...
|
#
d7b837e7 |
| 29-Aug-2013 |
Alexander Kornienko <alexfh@google.com> |
Better support for multiline string literals (including C++11 raw string literals).
Summary: Calculate characters in the first and the last line correctly so that we only break before the literal wh
Better support for multiline string literals (including C++11 raw string literals).
Summary: Calculate characters in the first and the last line correctly so that we only break before the literal when needed.
Reviewers: djasper
Reviewed By: djasper
CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D1544
llvm-svn: 189595
show more ...
|
#
31c85921 |
| 29-Aug-2013 |
Manuel Klimek <klimek@google.com> |
Fixes various problems with accounting for tabs in the original code.
We now count the original token's column directly when lexing the tokens, where we already have all knowledge about where lines
Fixes various problems with accounting for tabs in the original code.
We now count the original token's column directly when lexing the tokens, where we already have all knowledge about where lines start.
Before this patch, formatting: void f() { \tg(); \th(); } would incorrectly count the \t's as 1 character if only the line containing h() was reformatted, and thus indent h() at offset 1.
llvm-svn: 189585
show more ...
|
#
2739af3b |
| 28-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Improve token breaking behavior.
Two changes: * Don't add an extra penalty on breaking the same token multiple times. Generally, we should prefer not to break, but once we break, the
clang-format: Improve token breaking behavior.
Two changes: * Don't add an extra penalty on breaking the same token multiple times. Generally, we should prefer not to break, but once we break, the normal line breaking penalties apply. * Slightly increase the penalty for breaking comments. In general, the author has put some thought into how to break the comment and we should not overwrite this unnecessarily.
With a 40-column column limit, formatting aaaaaa("aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa");
Leads to: Before: aaaaaa( "aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa " "aaaaaaaaaaaaaaaa");
After: aaaaaa("aaaaaaaaaaaaaaaa " "aaaaaaaaaaaaaaaa " "aaaaaaaaaaaaaaaa");
llvm-svn: 189466
show more ...
|
#
12f4f119 |
| 22-Aug-2013 |
Daniel Jasper <djasper@google.com> |
Work around unused variable warning in release builds.
llvm-svn: 189028
|
#
8de9ed05 |
| 22-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Add column layout formatting for braced lists
With this patch, braced lists (with more than 3 elements are formatted in a column layout if possible). E.g.:
static const uint16_t Cal
clang-format: Add column layout formatting for braced lists
With this patch, braced lists (with more than 3 elements are formatted in a column layout if possible). E.g.:
static const uint16_t CallerSavedRegs64Bit[] = { X86::RAX, X86::RDX, X86::RCX, X86::RSI, X86::RDI, X86::R8, X86::R9, X86::R10, X86::R11, 0 };
Required other changes: - FormatTokens can now have a special role that contains extra data and can do special formattings. A comma separated list is currently the only implementation. - Move penalty calculation entirely into ContinuationIndenter (there was a last piece still in UnwrappedLineFormatter).
Review: http://llvm-reviews.chandlerc.com/D1457 llvm-svn: 189018
show more ...
|
#
f110e201 |
| 21-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Indent relative to unary operators.
Before: if (!aaaaaaaaaa( // break aaaaa)) { }
After: if (!aaaaaaaaaa( // break aaaaa)) { }
Also cleaned up formatti
clang-format: Indent relative to unary operators.
Before: if (!aaaaaaaaaa( // break aaaaa)) { }
After: if (!aaaaaaaaaa( // break aaaaa)) { }
Also cleaned up formatting using clang-format.
llvm-svn: 188891
show more ...
|
#
b55acad9 |
| 20-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Additional options for spaces around parentheses.
This patch adds four new options to control: - Spaces after control keyworks (if(..) vs if (..)) - Spaces in empty parentheses (f( ) v
clang-format: Additional options for spaces around parentheses.
This patch adds four new options to control: - Spaces after control keyworks (if(..) vs if (..)) - Spaces in empty parentheses (f( ) vs f()) - Spaces in c-style casts (( int )1.0 vs (int)1.0) - Spaces in other parentheses (f(a) vs f( a ))
Patch by Joe Hermaszewski. Thank you for working on this!
llvm-svn: 188793
show more ...
|
#
de0328ae |
| 16-Aug-2013 |
Daniel Jasper <djasper@google.com> |
Split UnwrappedLineFormatter into individual components.
Goals: Structure code better and make components easier to use for future features (e.g. column layout for long braced initializers).
No fun
Split UnwrappedLineFormatter into individual components.
Goals: Structure code better and make components easier to use for future features (e.g. column layout for long braced initializers).
No functional changes intended.
llvm-svn: 188543
show more ...
|
#
cdaffa45 |
| 13-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Add option for the offset of constructor initializers.
Some coding styles use a different indent for constructor initializers.
Patch by Klemens Baum. Thank you. Review: http://llvm-re
clang-format: Add option for the offset of constructor initializers.
Some coding styles use a different indent for constructor initializers.
Patch by Klemens Baum. Thank you. Review: http://llvm-reviews.chandlerc.com/D1360
Post review changes: Changed data type to unsigned as a negative indent width does not make sense and added test for configuration parsing.
llvm-svn: 188260
show more ...
|
#
467ddb16 |
| 12-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Improve stream-formatting.
Before: CHECK(controller->WriteProto(FLAGS_row_key, FLAGS_proto)) << "\"" << FLAGS_proto
clang-format: Improve stream-formatting.
Before: CHECK(controller->WriteProto(FLAGS_row_key, FLAGS_proto)) << "\"" << FLAGS_proto << "\"";
After: SemaRef.Diag(Loc, diag::note_for_range_begin_end) << BEF << IsTemplate << Description << E->getType();
llvm-svn: 188175
show more ...
|
#
5903685a |
| 12-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Correctly format alias declarations.
Before: template <class CallbackClass> using MyCallback = void(CallbackClass::*)(SomeObject * Data);");
After: template <class CallbackClass
clang-format: Correctly format alias declarations.
Before: template <class CallbackClass> using MyCallback = void(CallbackClass::*)(SomeObject * Data);");
After: template <class CallbackClass> using MyCallback = void (CallbackClass::*)(SomeObject *Data);");
Also fix three wrong indentations.
llvm-svn: 188172
show more ...
|
#
a027f306 |
| 07-Aug-2013 |
Manuel Klimek <klimek@google.com> |
Fixes a couple of bugs with the Allman brace breaking.
In particular, left braces after an enum declaration now occur on their own line. Further, when short ifs/whiles are allowed these no longer c
Fixes a couple of bugs with the Allman brace breaking.
In particular, left braces after an enum declaration now occur on their own line. Further, when short ifs/whiles are allowed these no longer cause the left brace to be on the same line as the if/while when a brace is included.
Patch by Thomas Gibson-Robinson.
llvm-svn: 187901
show more ...
|
#
d3ed59ae |
| 02-Aug-2013 |
Manuel Klimek <klimek@google.com> |
Implement Allman style.
Patch by Frank Miller.
llvm-svn: 187678
|
#
3dcd7eca |
| 02-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Fix string breaking after "<<".
Before, clang-format would not break overly long string literals following a "<<" with FormatStyle::AlwaysBreakBeforeMultilineStrings being set.
llvm-s
clang-format: Fix string breaking after "<<".
Before, clang-format would not break overly long string literals following a "<<" with FormatStyle::AlwaysBreakBeforeMultilineStrings being set.
llvm-svn: 187650
show more ...
|
#
b1ae734f |
| 01-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Don't break empty 2nd operand of ternary expr.
Before: some_quite_long_variable_name_ptr ? : argv[9] ? ptr : argv[8] ? : argv[7] ? ptr : argv[6]; After: some_quite_long
clang-format: Don't break empty 2nd operand of ternary expr.
Before: some_quite_long_variable_name_ptr ? : argv[9] ? ptr : argv[8] ? : argv[7] ? ptr : argv[6]; After: some_quite_long_variable_name_ptr ?: argv[9] ? ptr : argv[8] ?: argv[7] ? ptr : argv[6];
Patch by Adam Strzelecki, thank you!!
This fixed llvm.org/PR16758.
llvm-svn: 187622
show more ...
|
#
8b1c6354 |
| 01-Aug-2013 |
Daniel Jasper <djasper@google.com> |
Teach clang-format to understand static_asserts better.
Before: template <bool B, bool C> class A { static_assert(B &&C, "Something is wrong"); };
After: template <bool B, bool C> cla
Teach clang-format to understand static_asserts better.
Before: template <bool B, bool C> class A { static_assert(B &&C, "Something is wrong"); };
After: template <bool B, bool C> class A { static_assert(B && C, "Something is wrong"); };
(Note the spacing around '&&'). Also change the identifier table to always understand all C++11 keywords (which seems like the right thing to do).
llvm-svn: 187589
show more ...
|
#
552f4a7e |
| 31-Jul-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Make alignment of trailing comments optional ..
.. in order to support WebKit style properly.
llvm-svn: 187549
|
#
65ee3472 |
| 31-Jul-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Add more options to namespace indentation.
With this patch, clang-format can be configured to: * not indent in namespace at all (former behavior). * indent in namespace as in other blo
clang-format: Add more options to namespace indentation.
With this patch, clang-format can be configured to: * not indent in namespace at all (former behavior). * indent in namespace as in other blocks. * indent only in inner namespaces (as required by WebKit style).
Also fix alignment of access specifiers in WebKit style.
Patch started by Marek Kurdej. Thank you!
llvm-svn: 187540
show more ...
|
#
e33d4afa |
| 26-Jul-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Add two new style options to support WebKit style.
New options: * Break before the commas of constructor initializers and align the commas with the colon. * Break before binary opera
clang-format: Add two new style options to support WebKit style.
New options: * Break before the commas of constructor initializers and align the commas with the colon. * Break before binary operators
Additionally, for styles without column limit, don't just accept linebreaks done by the user, but instead remove 'invalid' (according to the current style) linebreaks and add 'required' ones.
llvm-svn: 187210
show more ...
|
#
ffefb3d1 |
| 24-Jul-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Initial (incomplete) support for the WebKit coding style.
This is far from implementing all the rules given by http://www.webkit.org/coding/coding-style.html
The important new feature
clang-format: Initial (incomplete) support for the WebKit coding style.
This is far from implementing all the rules given by http://www.webkit.org/coding/coding-style.html
The important new feature is the support for styles that don't have a column limit. For such styles, clang-format will (at the moment) simply respect the input's formatting decisions within statements.
llvm-svn: 187033
show more ...
|
#
c834c709 |
| 17-Jul-2013 |
Daniel Jasper <djasper@google.com> |
Improve line breaking before multi-line strings.
The AlwaysBreakBeforeMultilineStrings rule does not really make sense if it does not a column gain.
Before (in Google style): f( "aaaa"
Improve line breaking before multi-line strings.
The AlwaysBreakBeforeMultilineStrings rule does not really make sense if it does not a column gain.
Before (in Google style): f( "aaaa" "bbbb");
After: f("aaaa" "bbbb");
llvm-svn: 186515
show more ...
|
#
94042342 |
| 16-Jul-2013 |
Alexander Kornienko <alexfh@google.com> |
Avoid breaking non-trailing block comments.
Motivating example: // column limit -------------------> void ffffffffffff(int aaaaaa /* test */);
Formatting before the patch: void ffffffffffff(int aaa
Avoid breaking non-trailing block comments.
Motivating example: // column limit -------------------> void ffffffffffff(int aaaaaa /* test */);
Formatting before the patch: void ffffffffffff(int aaaaaa /* test */);
Formatting after the patch: void ffffffffffff(int aaaaaa /* test */);
llvm-svn: 186471
show more ...
|
#
657c67b1 |
| 16-Jul-2013 |
Alexander Kornienko <alexfh@google.com> |
Don't break line comments with escaped newlines.
Summary: These can appear when comments contain command lines with quoted line breaks. As the text (including escaped newlines and '//' from consecut
Don't break line comments with escaped newlines.
Summary: These can appear when comments contain command lines with quoted line breaks. As the text (including escaped newlines and '//' from consecutive lines) is a single line comment, we used to break it even when it didn't exceed column limit. This is a temporary solution, in the future we may want to support this case completely - at least adjust leading whitespace when changing indentation of the first line.
Reviewers: djasper
Reviewed By: djasper
CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D1146
llvm-svn: 186456
show more ...
|