#
13dbaa09 |
| 01-Feb-2017 |
Krasimir Georgiev <krasimir@google.com> |
[clang-format] Fix regression about not aligning trailing comments in case they were previously aligned, but at different indent.
Summary: Comment reflower was adding untouchable tokens in case two
[clang-format] Fix regression about not aligning trailing comments in case they were previously aligned, but at different indent.
Summary: Comment reflower was adding untouchable tokens in case two consecutive comment lines are aligned in the source code. This disallows the whitespace manager to re-indent them later.
source: ``` int i = f(abc, // line 1 d, // line 2 // line 3 b); ``` Since line 2 and line 3 are aligned, the reflower was marking line 3 as untouchable; however the three comment lines need to be re-aligned. output before: ``` int i = f(abc, // line 1 d, // line 2 // line 3 b); ``` output after: ``` int i = f(abc, // line 1 d, // line 2 // line 3 b); ```
Reviewers: djasper
Reviewed By: djasper
Subscribers: sammccall, cfe-commits, klimek
Differential Revision: https://reviews.llvm.org/D29383
llvm-svn: 293755
show more ...
|
#
21f7dea5 |
| 01-Feb-2017 |
Daniel Jasper <djasper@google.com> |
clang-format: Don't force-wrap multiline RHSs for 2-operand experssions.
This rows back on r288120, r291801 and r292110. I apologize in advance for the churn. All of those revisions where meant to m
clang-format: Don't force-wrap multiline RHSs for 2-operand experssions.
This rows back on r288120, r291801 and r292110. I apologize in advance for the churn. All of those revisions where meant to make the wrapping of RHS expressions more consistent. However, now that they are consistent, we seem to be a bit too eager.
The reasoning here is that I think it is generally correct that we want to line-wrap before multiline RHS expressions (or multiline arguments to a function call). However, if there are only two of such operands or arguments, there is always a clear vertical separation between them and the additional line break seems much less desirable.
Somewhat good examples are expressions like:
EXPECT_EQ(2, someLongExpression( orCall));
llvm-svn: 293752
show more ...
|
#
b796cebf |
| 31-Jan-2017 |
Krasimir Georgiev <krasimir@google.com> |
[clang-format] Fix regression about adding leading whitespace to the content of line comments
Summary: The reflower didn't measure precisely the line column of a line in the middle of a line comment
[clang-format] Fix regression about adding leading whitespace to the content of line comments
Summary: The reflower didn't measure precisely the line column of a line in the middle of a line comment section that has a prefix that needs to be adapted.
source: ``` /// a //b ```
format before: ``` /// a //b ```
format after: ``` /// a // b ```
Reviewers: djasper
Reviewed By: djasper
Subscribers: sammccall, cfe-commits, klimek
Differential Revision: https://reviews.llvm.org/D29329
llvm-svn: 293641
show more ...
|
#
af1b9622 |
| 31-Jan-2017 |
Krasimir Georgiev <krasimir@google.com> |
[clang-format] Fix reflow in block comment lines with leading whitespace.
Summary: The reflower was not taking into account the additional leading whitespace in block comment lines.
source: ``` {
[clang-format] Fix reflow in block comment lines with leading whitespace.
Summary: The reflower was not taking into account the additional leading whitespace in block comment lines.
source: ``` { /* * long long long long * long * long long long long */ } ```
format (with column limit 20) before: ``` { /* * long long long * long long long long * long long */ } ``` format after: ``` { /* * long long long * long long long * long long long */ } ```
Reviewers: djasper, klimek
Reviewed By: djasper
Subscribers: cfe-commits, sammccall, klimek
Differential Revision: https://reviews.llvm.org/D29326
llvm-svn: 293633
show more ...
|
#
753625b6 |
| 31-Jan-2017 |
Krasimir Georgiev <krasimir@google.com> |
[clang-format] Fix regression merging comments across newlines.
Summary: This fixes a regression that causes example: ``` enum A { a, // line a
// line b b }; ``` to be formatted as follows:
[clang-format] Fix regression merging comments across newlines.
Summary: This fixes a regression that causes example: ``` enum A { a, // line a
// line b b }; ``` to be formatted as follows: ``` enum A { a, // line a // line b b }; ```
Reviewers: djasper, klimek
Reviewed By: klimek
Subscribers: cfe-commits, sammccall, djasper, klimek
Differential Revision: https://reviews.llvm.org/D29322
llvm-svn: 293624
show more ...
|
#
8f62cf74 |
| 31-Jan-2017 |
Krasimir Georgiev <krasimir@google.com> |
[clang-format] Don't reflow comment lines starting with '@'.
Summary: This patch stops reflowing comment lines starting with '@', since they commonly have a special meaning.
Reviewers: djasper
Rev
[clang-format] Don't reflow comment lines starting with '@'.
Summary: This patch stops reflowing comment lines starting with '@', since they commonly have a special meaning.
Reviewers: djasper
Reviewed By: djasper
Subscribers: cfe-commits, klimek
Differential Revision: https://reviews.llvm.org/D29323
llvm-svn: 293617
show more ...
|
#
e518e0bf |
| 30-Jan-2017 |
Krasimir Georgiev <krasimir@google.com> |
[clang-format] Fix regression that breaks comments without a comment prefix
Summary: Consider formatting the following code fragment with column limit 20: ``` { // line 1 // line 2\ // long lo
[clang-format] Fix regression that breaks comments without a comment prefix
Summary: Consider formatting the following code fragment with column limit 20: ``` { // line 1 // line 2\ // long long long line } ``` Before this fix the output is: ``` { // line 1 // line 2\ // long long long line } ``` This patch fixes a regression that breaks the last comment line without adding the '//' prefix.
Reviewers: djasper
Reviewed By: djasper
Subscribers: cfe-commits, klimek
Differential Revision: https://reviews.llvm.org/D29298
llvm-svn: 293548
show more ...
|
#
8432161f |
| 30-Jan-2017 |
Krasimir Georgiev <krasimir@google.com> |
[clang-format] Separate line comment sections after a right brace from comment sections in the scope.
Summary: The following two comment lines form a single comment section: ``` if (1) { // line 1
[clang-format] Separate line comment sections after a right brace from comment sections in the scope.
Summary: The following two comment lines form a single comment section: ``` if (1) { // line 1 // line 2 } ``` This is because the break of a comment section was based on the original column of the first token of the previous line (in this case, the 'if'). This patch splits these two comment lines into different sections by taking into account the original column of the right brace preceding the first line comment where applicable.
Reviewers: djasper
Reviewed By: djasper
Subscribers: cfe-commits, klimek
Differential Revision: https://reviews.llvm.org/D29291
llvm-svn: 293539
show more ...
|
#
91834227 |
| 25-Jan-2017 |
Krasimir Georgiev <krasimir@google.com> |
[clang-format] Implement comment reflowing.
Summary: This presents a version of the comment reflowing with less mutable state inside the comment breakable token subclasses. The state has been pushed
[clang-format] Implement comment reflowing.
Summary: This presents a version of the comment reflowing with less mutable state inside the comment breakable token subclasses. The state has been pushed into the driving breakProtrudingToken method. For this, the API of BreakableToken is enriched by the methods getSplitBefore and getLineLengthAfterSplitBefore.
Reviewers: klimek
Reviewed By: klimek
Subscribers: djasper, klimek, mgorny, cfe-commits, ioeric
Differential Revision: https://reviews.llvm.org/D28764
llvm-svn: 293055
show more ...
|
#
7eb7507a |
| 20-Jan-2017 |
Antonio Maiorano <amaiorano@gmail.com> |
clang-format: fix fallback style set to "none" not always formatting
This fixes clang-format not formatting if fallback-style is explicitly set to "none", and either a config file is found or YAML i
clang-format: fix fallback style set to "none" not always formatting
This fixes clang-format not formatting if fallback-style is explicitly set to "none", and either a config file is found or YAML is passed in without a "BasedOnStyle". With this change, passing "none" in these cases will have no affect, and LLVM style will be used as the base style.
Differential Revision: https://reviews.llvm.org/D28844
llvm-svn: 292562
show more ...
|
Revision tags: llvmorg-4.0.0-rc1 |
|
#
3adfb6a3 |
| 17-Jan-2017 |
Antonio Maiorano <amaiorano@gmail.com> |
clang-format: Make GetStyle return Expected<FormatStyle> instead of FormatStyle
Change the contract of GetStyle so that it returns an error when an error occurs (i.e. when it writes to stderr), and
clang-format: Make GetStyle return Expected<FormatStyle> instead of FormatStyle
Change the contract of GetStyle so that it returns an error when an error occurs (i.e. when it writes to stderr), and only returns the fallback style when it can't find a configuration file.
Differential Revision: https://reviews.llvm.org/D28081
llvm-svn: 292174
show more ...
|
#
240527ca |
| 16-Jan-2017 |
Daniel Jasper <djasper@google.com> |
clang-format: Always wrap before multi-line parameters/operands.
Before: aaaaaaaaaaaaaaaaaa(aaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:: aaaaaaaaaaaaaaaaa
clang-format: Always wrap before multi-line parameters/operands.
Before: aaaaaaaaaaaaaaaaaa(aaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaa);
After: aaaaaaaaaaaaaaaaaa(aaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaa);
No new test cases, as the existing ones cover this fairly well.
llvm-svn: 292110
show more ...
|
#
e61f9f99 |
| 13-Jan-2017 |
Daniel Jasper <djasper@google.com> |
clang-format: Fix bug in making line break decisions.
Here, the optimization to not line wrap when it would not lead to a reduction in columns was overwriting and enforced break that we want to do n
clang-format: Fix bug in making line break decisions.
Here, the optimization to not line wrap when it would not lead to a reduction in columns was overwriting and enforced break that we want to do no matter what.
Before: int i = someFunction( aaaaaaa, 0).aaa(aaaaaaaaaaaaa) * aaaaaaa + aaaaaaa;
After: int i = someFunction(aaaaaaa, 0) .aaa(aaaaaaaaaaaaa) * aaaaaaa + aaaaaaa;
llvm-svn: 291974
show more ...
|
#
e3710107 |
| 12-Jan-2017 |
Daniel Jasper <djasper@google.com> |
clang-format: Fix regression introduced by r291801.
Uncovered by polly tests.
Before: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaa, {}, aaaaaaaaaaaaaaaaaaaa
clang-format: Fix regression introduced by r291801.
Uncovered by polly tests.
Before: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaa, {}, aaaaaaaaaaaaaaaaaaaaaaa);
After: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaa, {}, aaaaaaaaaaaaaaaaaaaaaaa);
llvm-svn: 291807
show more ...
|
#
d1a9d8ac |
| 12-Jan-2017 |
Daniel Jasper <djasper@google.com> |
clang-format: Treat braced lists like other complex parameters.
Specifically, wrap before them if they are multi-line so that we don't create long hanging indents. This prevents having a lot of code
clang-format: Treat braced lists like other complex parameters.
Specifically, wrap before them if they are multi-line so that we don't create long hanging indents. This prevents having a lot of code indented a lot in some cases.
Before: someFunction(Param, {List1, List2, List3});
After: someFunction(Param, {List1, List2, List3});
llvm-svn: 291801
show more ...
|
#
c941e7d2 |
| 09-Jan-2017 |
Daniel Jasper <djasper@google.com> |
clang-format: Improve support for override/final as variable names.
Before: bool a = f() &&override.f(); bool a = f() &&final.f(); void f(const MyOverride & override); void f(const MyFinal &
clang-format: Improve support for override/final as variable names.
Before: bool a = f() &&override.f(); bool a = f() &&final.f(); void f(const MyOverride & override); void f(const MyFinal & final);
After: bool a = f() && override.f(); bool a = f() && final.f(); void f(const MyOverride &override); void f(const MyFinal &final);
llvm-svn: 291434
show more ...
|
#
2388861f |
| 22-Dec-2016 |
Daniel Jasper <djasper@google.com> |
clang-format: Less eagerly try to keep label-value pairs on a line.
Before: string v = StrCat("aaaaaaaaaaaaaaaaaaaaaaaaaaa: ", SomeFunction(aaaaaaaaaaaa,
clang-format: Less eagerly try to keep label-value pairs on a line.
Before: string v = StrCat("aaaaaaaaaaaaaaaaaaaaaaaaaaa: ", SomeFunction(aaaaaaaaaaaa, aaaaaaaaaaaaaaa), bbbbbbbbbbbbbbbbbbbbbbb);
After: string v = StrCat("aaaaaaaaaaaaaaaaaaaaaaaaaaa: ", SomeFunction(aaaaaaaaaaaa, aaaaaaaaaaaaaaa), bbbbbbbbbbbbbbbbbbbbbbb);
llvm-svn: 290337
show more ...
|
#
34c03764 |
| 22-Dec-2016 |
Antonio Maiorano <amaiorano@gmail.com> |
Make FormatStyle.GetStyleOfFile test work on MSVC
Modify getStyle to use vfs::FileSystem::makeAbsolute just like FS.addFile does, rather than sys::fs::make_absolute. The latter gets the CWD from the
Make FormatStyle.GetStyleOfFile test work on MSVC
Modify getStyle to use vfs::FileSystem::makeAbsolute just like FS.addFile does, rather than sys::fs::make_absolute. The latter gets the CWD from the platform, while the former expects it to be set by the client, causing a mismatch when converting relative paths to absolute.
Differential Revision: https://reviews.llvm.org/D27971
llvm-svn: 290319
show more ...
|
#
083d1700 |
| 21-Dec-2016 |
Daniel Jasper <djasper@google.com> |
clang-format: Fix bug in handling of single-column lists.
Members that are themselves wrapped in fake parentheses would lead to AvoidBinPacking be set on the wrong ParenState.
After: vector<int>
clang-format: Fix bug in handling of single-column lists.
Members that are themselves wrapped in fake parentheses would lead to AvoidBinPacking be set on the wrong ParenState.
After: vector<int> aaaa = { aaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaa.aaaaaaa, aaaaaa.aaaaaaa, aaaaaa.aaaaaaa, aaaaaa.aaaaaaa, };
Before we were falling back to bin-packing these.
llvm-svn: 290259
show more ...
|
#
f789f05e |
| 20-Dec-2016 |
Daniel Jasper <djasper@google.com> |
clang-format: Fix bug in understanding string-label&value analysis.
While for <<-operators often used in log statments, a single key value pair is always on the second operator, e.g.
llvm::errs()
clang-format: Fix bug in understanding string-label&value analysis.
While for <<-operators often used in log statments, a single key value pair is always on the second operator, e.g.
llvm::errs() << "aaaaa=" << aaaaa;
It is on the first operator for plus- or comma-concatenated strings:
string s = "aaaaaaaaaa: " + aaaaaaaa;
(the "=" not counting because that's a different operator precedence)
llvm-svn: 290177
show more ...
|
#
7aacf468 |
| 19-Dec-2016 |
Daniel Jasper <djasper@google.com> |
clang-format: Slightly tweak the behavior of <<-wrapping.
Before: SomeLongLoggingStatementOrMacro() << "Some long text " << some_variable << "\n";
Before: So
clang-format: Slightly tweak the behavior of <<-wrapping.
Before: SomeLongLoggingStatementOrMacro() << "Some long text " << some_variable << "\n";
Before: SomeLongLoggingStatementOrMacro() << "Some long text " << some_variable << "\n";
Short logging statements are already special cased in a different part of the code.
llvm-svn: 290094
show more ...
|
#
ff8d6136 |
| 19-Dec-2016 |
Daniel Jasper <djasper@google.com> |
clang-format: Fix regression introduced in r290084.
We still want to try in linewrap within single elements of a 1-column list.
After: Type *Params[] = {PointerType::getUnqual(FunctionType::get(
clang-format: Fix regression introduced in r290084.
We still want to try in linewrap within single elements of a 1-column list.
After: Type *Params[] = {PointerType::getUnqual(FunctionType::get( Builder.getVoidTy(), Builder.getInt8PtrTy(), false)), Builder.getInt8PtrTy(), Builder.getInt32Ty(), LongType, LongType, LongType};
Before: No line break in the first element, so column limit violation.
llvm-svn: 290090
show more ...
|
#
e6169665 |
| 19-Dec-2016 |
Daniel Jasper <djasper@google.com> |
clang-format: Allow "single column" list layout even if that violates the column limit.
Single-column layout basically means that we format the list with one element per line. Not doing that when th
clang-format: Allow "single column" list layout even if that violates the column limit.
Single-column layout basically means that we format the list with one element per line. Not doing that when there is a column limit violation doesn't change the fact that there is an item that doesn't fit within the column limit.
Before (with a column limit of 30): std::vector<int> a = { aaaaaaaa, aaaaaaaa, aaaaaaaa, aaaaaaaa, aaaaaaaaaa, aaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaa};
After: std::vector<int> a = { aaaaaaaa, aaaaaaaa, aaaaaaaa, aaaaaaaa, aaaaaaaaaa, aaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaa};
(and previously we would have formatted like "After" it wasn't for the one item that is too long)
llvm-svn: 290084
show more ...
|
#
7209bb9d |
| 13-Dec-2016 |
Daniel Jasper <djasper@google.com> |
clang-format: Keep string-literal-label + value pairs on a line.
We have previously done that for <<-operators. This patch also adds this logic for "," and "+".
Before: string v = "aaaaaaaaaaaaaa
clang-format: Keep string-literal-label + value pairs on a line.
We have previously done that for <<-operators. This patch also adds this logic for "," and "+".
Before: string v = "aaaaaaaaaaaaaaaa: " + aaaaaaaaaaaaaaaa + "aaaaaaaaaaaaaaaa: " + aaaaaaaaaaaaaaaa + "aaaaaaaaaaaaaaaa: " + aaaaaaaaaaaaaaaa; string v = StrCat("aaaaaaaaaaaaaaaa: ", aaaaaaaaaaaaaaaa, "aaaaaaaaaaaaaaaa: ", aaaaaaaaaaaaaaaa, "aaaaaaaaaaaaaaaa: ", aaaaaaaaaaaaaaaa);
After: string v = "aaaaaaaaaaaaaaaa: " + aaaaaaaaaaaaaaaa + "aaaaaaaaaaaaaaaa: " + aaaaaaaaaaaaaaaa + "aaaaaaaaaaaaaaaa: " + aaaaaaaaaaaaaaaa; string v = StrCat("aaaaaaaaaaaaaaaa: ", aaaaaaaaaaaaaaaa, "aaaaaaaaaaaaaaaa: ", aaaaaaaaaaaaaaaa, "aaaaaaaaaaaaaaaa: ", aaaaaaaaaaaaaaaa);
llvm-svn: 289531
show more ...
|
#
e4ada024 |
| 13-Dec-2016 |
Daniel Jasper <djasper@google.com> |
clang-format: Improve braced-list detection.
Before: vector<int> v { 12 } GUARDED_BY(mutex);
After: vector<int> v{12} GUARDED_BY(mutex);
llvm-svn: 289525
|