#
786a550b |
| 06-Sep-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Format typed enums with nested names.
The explicit type specified for an enum can actually have a nested name specifier.
This fixes llvm.org/PR17125.
llvm-svn: 190208
|
#
b4b99987 |
| 06-Sep-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Don't confuse operator[] with lambdas.
Before: double &operator[](int i) { return 0; } int i;
After: double &operator[](int i) { return 0; } int i;
This fixes llvm.org/PR17134.
clang-format: Don't confuse operator[] with lambdas.
Before: double &operator[](int i) { return 0; } int i;
After: double &operator[](int i) { return 0; } int i;
This fixes llvm.org/PR17134.
llvm-svn: 190207
show more ...
|
#
9ab4a77a |
| 06-Sep-2013 |
Alexander Kornienko <alexfh@google.com> |
Don't remove trailing escaped newline from line comments.
llvm-svn: 190175
|
#
36c28ce3 |
| 06-Sep-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Fix regression introduced by r189353.
Before: FirstToken->WhitespaceRange.getBegin() .getLocWithOffset(First->LastNewlineOffset);
After: FirstToken->WhitespaceRange.getBegin
clang-format: Fix regression introduced by r189353.
Before: FirstToken->WhitespaceRange.getBegin() .getLocWithOffset(First->LastNewlineOffset);
After: FirstToken->WhitespaceRange.getBegin().getLocWithOffset( First->LastNewlineOffset);
Re-add logic to prevent breaking after an empty set of parentheses. Basically it seems that calling a function without parameters is more like navigating along the same object than it is a separate step of a builder-type call.
We might need to extends this in future to allow "short" parameters that e.g. are an index accessing a specific element.
llvm-svn: 190126
show more ...
|
#
562ecd44 |
| 06-Sep-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Fix regression introduced by r189337.
Before: if (aaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) == 5) ...
After: if
clang-format: Fix regression introduced by r189337.
Before: if (aaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) == 5) ...
After: if (aaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) == 5) ...
Also precompute startsBinaryExpression() to improve performance.
llvm-svn: 190124
show more ...
|
#
1c5d9df8 |
| 06-Sep-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Fix comment formatting bugs in nested blocks.
This fixes two issues: 1) The indent of a line comment was not adapted to the subsequent statement as it would be outside of a nested b
clang-format: Fix comment formatting bugs in nested blocks.
This fixes two issues: 1) The indent of a line comment was not adapted to the subsequent statement as it would be outside of a nested block. 2) A missing DryRun flag caused actualy breaks to be inserted in overly long comments while trying to come up with the best line breaking decisions.
llvm-svn: 190123
show more ...
|
#
9a53c7f4 |
| 05-Sep-2013 |
Manuel Klimek <klimek@google.com> |
Fixes PR 17106 (explicitly typed enums are formatted differently).
Before: enum X : int { A, B, C };
After: enum X : int { A, B, C };
llvm-svn: 190054
|
#
ebb43caa |
| 05-Sep-2013 |
Alexander Kornienko <alexfh@google.com> |
Handle zero-width and double-width characters in string literals and comments.
Summary: Count column width instead of the number of code points. This also includes correct handling of tabs inside st
Handle zero-width and double-width characters in string literals and comments.
Summary: Count column width instead of the number of code points. This also includes correct handling of tabs inside string literals and comments (with an exception of multiline string literals/comments, where tabs are present before the first escaped newline).
Reviewers: djasper, klimek
Reviewed By: klimek
CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D1601
llvm-svn: 190052
show more ...
|
#
bf02b2c1 |
| 05-Sep-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Quickfix for braced init lists detected as lambdas.
Before: constexpr char hello [] { "hello" };
After: constexpr char hello[]{ "hello" };
llvm-svn: 190046
|
#
9a8d48b5 |
| 05-Sep-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Fix parsing and indenting lambdas.
Before: void f() { other(x.begin(), x.end(), // [&](int, int) { return 1; }); }
After: void f() { other(x.beg
clang-format: Fix parsing and indenting lambdas.
Before: void f() { other(x.begin(), x.end(), // [&](int, int) { return 1; }); }
After: void f() { other(x.begin(), x.end(), // [&](int, int) { return 1; }); }
llvm-svn: 190039
show more ...
|
#
9fe0e8da |
| 05-Sep-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Enable formatting of nested blocks.
Among other things, this enables (better) formatting lambdas and constructs like: MACRO({ long_statement(); long_statement_2()
clang-format: Enable formatting of nested blocks.
Among other things, this enables (better) formatting lambdas and constructs like: MACRO({ long_statement(); long_statement_2(); }, { long_statement(); long_statement_2(); }, { short_statement(); }, "");
This fixes llvm.org/PR15381.
llvm-svn: 190038
show more ...
|
#
b40cfe48 |
| 04-Sep-2013 |
Alexander Kornienko <alexfh@google.com> |
Handle 'Cpp03' and 'Cpp11' strings in LanguageStandard serialization for consistency of serialized form with the actual enum member names without a prefix.
llvm-svn: 189936
|
#
516e054c |
| 04-Sep-2013 |
Manuel Klimek <klimek@google.com> |
Implement parsing of blocks (^{ ... }) in the unwrapped line parser.
This patch makes sure we produce the right number of unwrapped lines, a follow-up patch will make the whitespace formatting consi
Implement parsing of blocks (^{ ... }) in the unwrapped line parser.
This patch makes sure we produce the right number of unwrapped lines, a follow-up patch will make the whitespace formatting consistent.
Before: void f() { int i = {[operation setCompletionBlock : ^{ [self onOperationDone]; }] } ; }
After: void f() { int i = {[operation setCompletionBlock : ^{ [self onOperationDone]; }] }; }
llvm-svn: 189932
show more ...
|
#
a1a43abe |
| 04-Sep-2013 |
Manuel Klimek <klimek@google.com> |
More lambda formatting tests; update test comments.
llvm-svn: 189928
|
#
bab25fdf |
| 04-Sep-2013 |
Manuel Klimek <klimek@google.com> |
Fix layout of lambda captures.
Before: int c = [ &, &a, a]{ [ =, c, &d]{ return b++; }(); }();
After: int c = [&, &a, a] { [=, c, &d] { return b++; }(); }();
llvm-svn: 18
Fix layout of lambda captures.
Before: int c = [ &, &a, a]{ [ =, c, &d]{ return b++; }(); }();
After: int c = [&, &a, a] { [=, c, &d] { return b++; }(); }();
llvm-svn: 189924
show more ...
|
#
ffdeb595 |
| 03-Sep-2013 |
Manuel Klimek <klimek@google.com> |
First step towards correctly formatting lambdas.
Implements parsing of lambdas in the UnwrappedLineParser. This introduces the correct line breaks; the formatting of lambda captures are still incorr
First step towards correctly formatting lambdas.
Implements parsing of lambdas in the UnwrappedLineParser. This introduces the correct line breaks; the formatting of lambda captures are still incorrect, and the braces are also still formatted as if they were braced init lists instead of blocks.
llvm-svn: 189818
show more ...
|
#
42401c8d |
| 02-Sep-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Fix segfault in overloaded operator parsing.
Before, constructs like: using A::operator+;
caused a segfault. This fixes llvm.org/PR17050.
llvm-svn: 189749
|
#
72407625 |
| 02-Sep-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Fix case-indentation in macros.
Before: #define OPERATION_CASE(name) \ case OP_name: \ return operations::Operation##name
After: #define O
clang-format: Fix case-indentation in macros.
Before: #define OPERATION_CASE(name) \ case OP_name: \ return operations::Operation##name
After: #define OPERATION_CASE(name) \ case OP_name: \ return operations::Operation##name
llvm-svn: 189743
show more ...
|
#
8ddfa848 |
| 30-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Enable formatting of protocol buffer definitions.
Almost by accident, clang-format seems to be able to format protocol buffer definitions (https://code.google.com/p/protobuf/).
The on
clang-format: Enable formatting of protocol buffer definitions.
Almost by accident, clang-format seems to be able to format protocol buffer definitions (https://code.google.com/p/protobuf/).
The only change is that a space is required between numeric constants and opening square brackets (for default values). While this might in theory be used for array subscripts (int val = 4[MyArray]), I have not seen this pattern in practice much. If this is wrong, we can make this smarter in the future.
llvm-svn: 189663
show more ...
|
#
b7150872 |
| 30-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Improve recovery from enums with errors.
Before: namespace n { enum Type { One, Two, // missing }; int i; } void g() { }
After: namespace n { enum Type { O
clang-format: Improve recovery from enums with errors.
Before: namespace n { enum Type { One, Two, // missing }; int i; } void g() { }
After: namespace n { enum Type { One, Two, // missing }; int i; } void g() {}
llvm-svn: 189662
show more ...
|
#
f79b0b15 |
| 30-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Fix incorrect indentation.
Before: aaaaaaaaaa(bbbbbbbbbbbbbbbbbbbbbbbbb.ccccccccccccccccc( dddddddddddddddddddddddddddddd)); aaaaaaaaaaa(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
clang-format: Fix incorrect indentation.
Before: aaaaaaaaaa(bbbbbbbbbbbbbbbbbbbbbbbbb.ccccccccccccccccc( dddddddddddddddddddddddddddddd)); aaaaaaaaaaa(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb( dddddddddddddddddddddddddddddd));
After: aaaaaaaaaaa(bbbbbbbbbbbbbbbbbbbbbbbbb.ccccccccccccccccc( dddddddddddddddddddddddddddddd)); aaaaaaaaaaa(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb( dddddddddddddddddddddddddddddd));
This was overlooked when interducing the new builder-type call detection in r189337. Also, some minor reorganization of a test.
llvm-svn: 189658
show more ...
|
#
2cf664fb |
| 30-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Don't indent builders relative to "return".
While this looks kind of nice, it wastes horizontal space and does not seem to be common in the LLVM codebase.
Before: return llvm::Strin
clang-format: Don't indent builders relative to "return".
While this looks kind of nice, it wastes horizontal space and does not seem to be common in the LLVM codebase.
Before: return llvm::StringSwitch<Reference::Kind>(name) .StartsWith(".eh_frame_hdr", ORDER_EH_FRAMEHDR) .StartsWith(".eh_frame", ORDER_EH_FRAME) .StartsWith(".init", ORDER_INIT) .StartsWith(".fini", ORDER_FINI) .StartsWith(".hash", ORDER_HASH) .Default(ORDER_TEXT);
After: return llvm::StringSwitch<Reference::Kind>(name) .StartsWith(".eh_frame_hdr", ORDER_EH_FRAMEHDR) .StartsWith(".eh_frame", ORDER_EH_FRAME) .StartsWith(".init", ORDER_INIT) .StartsWith(".fini", ORDER_FINI) .StartsWith(".hash", ORDER_HASH) .Default(ORDER_TEXT);
llvm-svn: 189657
show more ...
|
#
f8151e9b |
| 30-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Fix corner case in builder-type calls.
Before: aaaaaaaaaaaaa->aaaaaaaaaaaaaaaaaaaaaaaa()->aaaaaaaaaaaaaae( 0)->aaaaaaaaaaaaaaa();
Af
clang-format: Fix corner case in builder-type calls.
Before: aaaaaaaaaaaaa->aaaaaaaaaaaaaaaaaaaaaaaa()->aaaaaaaaaaaaaae( 0)->aaaaaaaaaaaaaaa();
After: aaaaaaaaaaaaa->aaaaaaaaaaaaaaaaaaaaaaaa() ->aaaaaaaaaaaaaae(0) ->aaaaaaaaaaaaaaa();
llvm-svn: 189655
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 ...
|