| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
I also proposed the change in Firefox .clang-format file:
https://bugzilla.mozilla.org/show_bug.cgi?id=1322321
Reviewers: klimek
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D27557
llvm-svn: 289660
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
vector<int> v { 12 }
GUARDED_BY(mutex);
After:
vector<int> v{12} GUARDED_BY(mutex);
llvm-svn: 289525
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
While C(++) and ObjC are generally formatted the same way and can be
mixed, people might want to choose different styles based on the
language. This patch recognizes .m and .mm files as ObjC and also
implements a very crude detection of whether or not a .h file contains
ObjC code. This can be improved over time.
Also move most of the ObjC tests into their own test file to keep file
size maintainable.
llvm-svn: 289428
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: djasper
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D27615
llvm-svn: 289203
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
of the file.
Summary:
This avoid inserting #include into:
- raw string literals containing #include.
- #if block.
- Special #include among declarations (e.g. functions).
Reviewers: djasper
Subscribers: cfe-commits, klimek
Differential Revision: https://reviews.llvm.org/D26909
llvm-svn: 288493
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Defining DEBUG_TYPE in a header file doesn't make sense.
It is already defined in the corresponding source file.
Reviewers: klimek, ioeric
Subscribers: klimek
Differential Revision: https://reviews.llvm.org/D27164
llvm-svn: 288125
|
|
|
|
| |
llvm-svn: 288121
|
|
|
|
|
|
|
|
|
| |
Specifically, if the RHS of a comma is a complex binary expression and
spans multiple lines, insert a line break before it. This usually is
often more readable compared to producing a hanging indent. See changes
in FormatTest.cpp for examples.
llvm-svn: 288120
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
aaaaaaaaaa(aaaa(aaaa,
aaaa), //
aaaa,
aaaaa);
After:
aaaaaaaaaa(aaaa(aaaa,
aaaa), //
aaaa, aaaaa);
llvm-svn: 288119
|
|
|
|
|
|
| |
No functional change.
llvm-svn: 287892
|
|
|
|
|
|
| |
Differential Revision: https://reviews.llvm.org/D19063
llvm-svn: 286973
|
|
|
|
|
|
| |
This fixes llvm.org/PR28063.
llvm-svn: 286715
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
when in template
Actual regression was introduced in r272668. This revision fixes JS script, but
also regress Cpp case. It manifests with spaces added when template is followed
with array. Bug 30527 mentions case of array as a nested template type
(foo<bar<baz>[]>). Fix is to detect such case and to prevent treating it as
array initialization, but as a subscript case. However, before r272668, this
case was treated simple because we were detecting it as a StartsObjCMethodExpr.
Same was true for other similar case - array of templates (foo<int>[]). This
patch tries to address two problems: 1) fixing regression 2) making sure both
cases (array as a nested type, array of templates) which were entering
StartsObjCMethodExpr branch are handled now appropriately.
https://reviews.llvm.org/D26163
Patch from Branko Kokanovic <branko@kokanovic.org>!
llvm-svn: 286507
|
|
|
|
| |
llvm-svn: 286469
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
See TypeScript grammar for tokens following 'declare':
https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#A.10
Additional minor change:
clang-format: [JS] Prevent ASI before const.
Reviewers: djasper
Subscribers: cfe-commits, klimek
Differential Revision: https://reviews.llvm.org/D26274
llvm-svn: 286468
|
|
|
|
|
|
|
| |
See TypeScript grammar for tokens following 'declare':
https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#A.10
llvm-svn: 286467
|
|
|
|
|
|
|
|
|
|
| |
Before:
var i = x!-1;
After:
var i = x! - 1;
llvm-svn: 286367
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In Format, remove the reformat() and clean() functions taking a SourceManager
and a FileID. Keep the versions taking StringRef Code.
- there was duplicated functionality
- the FileID versions were harder to use
- the clean() version is dead code anyways
Patch by Krasimir Georgiev. Thank you.
llvm-svn: 286243
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
aaaaaaaaaaaaaaa<
aaaaaaaaa, aaaaaaaaaa,
aaaaaaaaaaaaaa><<<aaaaaaaaa, aaaaaaaaaa, aaaaaaaaaaaaaaaaaa>>>();
After:
aaaaaaaaaaaaaaa<aaaaaaaaa, aaaaaaaaaa, aaaaaaaaaaaaaa>
<<<aaaaaaaaa, aaaaaaaaaa, aaaaaaaaaaaaaaaaaa>>>();
llvm-svn: 286041
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
During clang-format source lexing >> and << operators are split and
treated as two less/greater operators but column position of following
tokens was not adjusted accordingly.
Fixes PR26887
Patch by Paweł Żukowski.
Reviewers: djasper
Subscribers: malcolm.parsons, mprobst, klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D25439
llvm-svn: 285934
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
template <typename T>
void F(T) &&
= delete;
After:
template <typename T>
void F(T) && = delete;
llvm-svn: 285674
|
|
|
|
|
|
|
|
|
|
| |
Before:
void f() { f(float{1}, a *a); }
After:
void f() { f(float{1}, a * a); }
llvm-svn: 285673
|
|
|
|
|
|
|
|
|
|
| |
Before:
aaaaa.as ();
After:
aaaaa.as();
llvm-svn: 285672
|
|
|
|
|
|
|
|
|
|
| |
Before:
int x = f(* + [] {});
After:
int x = f(*+[] {});
llvm-svn: 285671
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
var x = {
a: function*
() {
//
}
}
After:
var x = {
a: function*() {
//
}
}
llvm-svn: 285670
|
|
|
|
|
|
|
|
|
|
| |
Before:
x.for () = 1;
After:
x.for() = 1;
llvm-svn: 285669
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reasoning:
- ExpressionParser uses a lot of stack for these, bad in some environments.
- Our formatting algorithm is N^3 and gets really slow.
- The resulting formatting is unlikely to be any good.
- This is probably generated code we're formatting by accident.
We treat these as unparseable, and signal incomplete formatting. 50 is
an arbitrary number, I've only seen real problems from ~150 levels.
Patch by Sam McCall. Thank you.
llvm-svn: 285570
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
class X {
delete(val) {
return null;
}
* gen() {
yield[1, 2];
}
* gen() {
yield{a: 1};
}
};
After:
class X {
delete(val) {
return null;
}
* gen() {
yield [1, 2];
}
* gen() {
yield {a: 1};
}
};
llvm-svn: 285569
|
|
|
|
| |
llvm-svn: 285178
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Previously, automatic semicolon insertion would add an unwrapped line
when a template string contained a line break.
var x = `foo${
bar}`;
Would be formatted with `bar...` on a separate line and no indent.
Reviewers: djasper
Subscribers: cfe-commits, klimek
Differential Revision: https://reviews.llvm.org/D25675
llvm-svn: 284807
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Remove colon and commas after replacing constructor body with = default.
Fix annotation of TT_CtorInitializerColon when preceded by a comment.
Reviewers: djasper
Subscribers: cfe-commits, klimek
Differential Revision: https://reviews.llvm.org/D25768
llvm-svn: 284732
|
|
|
|
| |
llvm-svn: 284667
|
|
|
|
| |
llvm-svn: 284589
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Introduces a separate target for comment manipulation.
Currently, comment manipulation is in BreakableComment.cpp.
Towards implementing comment reflowing, we want to factor out the
comment-related functionality, so it can be reused.
Start simple by just moving out getLineCommentIndentPrefix.
Patch by Krasimir Georgiev!
Reviewers: djasper
Subscribers: klimek, beanz, mgorny, modocache
Differential Revision: https://reviews.llvm.org/D25725
llvm-svn: 284573
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: ioeric
Subscribers: klimek
Patch by Krasimir Georgiev!
Differential Revision: https://reviews.llvm.org/D25599
llvm-svn: 284228
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: Patch by Sam McCall!
Reviewers: djasper
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D25162
llvm-svn: 283332
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
end of the code which does not end with newline.
Summary:
append newline after code when inserting new headers at the end of the
code which does not end with newline.
Reviewers: djasper
Subscribers: cfe-commits, klimek
Differential Revision: https://reviews.llvm.org/D21026
llvm-svn: 283330
|
|
|
|
|
|
|
|
|
|
| |
Before:
for (int*p, *q; p != q; p = p->next) {
After:
for (int *p, *q; p != q; p = p->next) {
llvm-svn: 283246
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This lets people link against LLVM and their own version of the UTF
library.
I determined this only affects llvm, clang, lld, and lldb by running
$ git grep -wl 'UTF[0-9]\+\|\bConvertUTF\bisLegalUTF\|getNumBytesFor' | cut -f 1 -d '/' | sort | uniq
clang
lld
lldb
llvm
Tested with
ninja lldb
ninja check-clang check-llvm check-lld
(ninja check-lldb doesn't complete for me with or without this patch.)
Reviewers: rnk
Subscribers: klimek, beanz, mgorny, llvm-commits
Differential Revision: https://reviews.llvm.org/D24996
llvm-svn: 282822
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes the following:
BOOL (^aaa)(void) = ^BOOL {
};
The first BOOL's token was getting set to TT_FunctionAnnotationRParen
incorrectly, which was causing an unexpected newline after (^aaa). This
was introduced in r245846.
Patch by Kent Sutherland, thank you!
llvm-svn: 282448
|
|
|
|
|
|
|
|
|
|
| |
Before (even with PointerAlignment: Left):
vector<int *> a, b;
After:
vector<int*> a, b;
llvm-svn: 282410
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
- If a replacement has offset UINT_MAX, length 0, and a replacement text
that is an #include directive, this will insert the #include into the
correct block in the \p Code.
- If a replacement has offset UINT_MAX, length 1, and a replacement text
that is the name of the header to be removed, the header will be removed
from \p Code if it exists.
Reviewers: djasper
Subscribers: cfe-commits, klimek
Differential Revision: https://reviews.llvm.org/D24829
llvm-svn: 282253
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Before:
class X {
delete () {
...
}
}
After:
class X {
delete() {
...
}
}
Reviewers: djasper
Subscribers: cfe-commits, klimek
Differential Revision: https://reviews.llvm.org/D24804
llvm-svn: 282138
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: @returns is incorrect code, the standard is @return. However wrapping it can still confuse users.
Reviewers: djasper
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D24767
llvm-svn: 282056
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Previously, clang-format would always insert an additional line break after the
import block if the main body started with a comment, due to loosing track of
the first non-import line.
Reviewers: djasper
Subscribers: cfe-commits, klimek
Differential Revision: https://reviews.llvm.org/D24708
llvm-svn: 281888
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
`// taze: ... from ...` comments are used help tools where a
specific global symbol comes from.
Before:
// taze: many, different, symbols from
// 'some_long_location_here'
After:
// taze: many, different, symbols from 'some_long_location_here'
Reviewers: djasper
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D24477
llvm-svn: 281857
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Before when a semicolon was missing after a boolean literal:
a = true
return 1;
clang-format would parse this as one line and format as:
a = true return 1;
It turns out that C++ does not consider `true` and `false` to be literals, we
have to check for that explicitly.
Reviewers: djasper
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D24574
llvm-svn: 281856
|
|
|
|
| |
llvm-svn: 281816
|