| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
| |
This is a first step for splitting the huge FormatTest.cpp into separate
files to make it easier to find specific tests.
llvm-svn: 239730
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
var someVariable = SomeFuntion(aaaa, [
aaaaaaaaaaaaaaaaaaaaaaaaaaa,
bbbbbbbbbbbbbbbbbbbbbbbbbbb,
ccccccccccccccccccccccccccc
],
aaaa);
After:
var someVariable = SomeFuntion(aaaa,
[
aaaaaaaaaaaaaaaaaaaaaaaaaaa,
bbbbbbbbbbbbbbbbbbbbbbbbbbb,
ccccccccccccccccccccccccccc
],
aaaa);
llvm-svn: 239722
|
|
|
|
|
|
|
|
|
|
| |
Before, these would not properly detected because of the char/string
literal found when re-lexing after the first `:
var x = `'`; // comment with matching quote '
var x = `"`; // comment with matching quote "
llvm-svn: 239693
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
int c = []() -> int *{ return 2; }();
After:
int c = []() -> int * { return 2; }();
Based on patch by James Dennett (http://reviews.llvm.org/D10410), thank you!
llvm-svn: 239600
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
case (my_int) ONE:
After:
case (my_int)ONE:
This fixed llvm.org/PR23760
llvm-svn: 239597
|
|
|
|
| |
llvm-svn: 239595
|
|
|
|
|
|
|
|
| |
by triggering automatic semicolon insertion changes.
NFC intended. Patch by Martin Probst.
llvm-svn: 239594
|
|
|
|
|
|
|
|
|
|
| |
Without it, it would do:
interface I {
x: string;
} var y;
llvm-svn: 239593
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
statement.
When an exported function would follow a class declaration, it would not
be recognized as a stand-alone function. That would then collapse the
following line with the current one, e.g.
class C {}
export function f() {} var x;
llvm-svn: 239592
|
|
|
|
|
|
|
|
|
|
| |
In the long run, these two might be independent or we might to only
allow specific combinations. Until we have a corresponding request,
however, it is hard to do the right thing and choose the right
configuration options. Thus, just don't touch the options yet and
just modify the behavior slightly.
llvm-svn: 239531
|
|
|
|
|
|
| |
And fix formatting issue discovered by that :-).
llvm-svn: 239530
|
|
|
|
|
|
|
|
|
|
|
| |
The following example used to crash clang-format.
#define a\
/**/}
Adjusting the indentation level cache for the line starting with the
comment would lead to an out-of-bounds array read.
llvm-svn: 239521
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before clang-format would e.g. add a space into
#define Q_FOREACH(x, y)
which turns this into a non-function-like macro.
Patch by Strager Neds, thank you!
llvm-svn: 239513
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
assignments as enums.
Top level object literals are treated as enums, and their k/v pairs are put on
separate lines:
X.Y = {
A: 1,
B: 2
};
However assignments within blocks should not be affected:
function x() {
y = {a:1, b:2};
}
This change fixes the second case. Patch by Martin Probst.
llvm-svn: 239462
|
|
|
|
| |
llvm-svn: 239404
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
template <typename T>
auto aaaaaaaaaaaaaaaaaaaaaa(T t) -> decltype(eaaaaaaaaaaaaaaa<T>(t.a)
.aaaaaaaa());
After:
template <typename T>
auto aaaaaaaaaaaaaaaaaaaaaa(T t)
-> decltype(eaaaaaaaaaaaaaaa<T>(t.a).aaaaaaaa());
Also add a test case for a difficult template parsing case I stumbled accross.
Needs fixing.
llvm-svn: 239149
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a more correct representation than using "Equality" introduced
in r238942 which was a quick fix to solve an actual regression.
According to the typescript spec, arrows behave like "low-precedence"
assignments.
Before:
var a = a.aaaaaaa((a: a) => aaaaaaaaaaaaaaaaaaaaa(bbbbbbbbb) &&
aaaaaaaaaaaaaaaaaaaaa(bbbbbbb));
After:
var a = a.aaaaaaa((a: a) => aaaaaaaaaaaaaaaaaaaaa(bbbbbbbbb) &&
aaaaaaaaaaaaaaaaaaaaa(bbbbbbb));
llvm-svn: 239137
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes a regression in literal formatting:
Before:
aaaaaaaaaaaaa = {
aaaaaaaaaaaaaaaaaaaaaaaaaaaa: (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) =>
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
};
After:
var aaaaaaaaaaaaaaaaaaaa = {
aaaaaaaaaaaaaaaaaaaaaaaaaaaa:
(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) =>
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
};
Also apply no-else-after-return policy.
llvm-svn: 238942
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
operators to the new line.
Before:
LOG_IF(aaa == //
bbb)
<< a
<< b;
After:
LOG_IF(aaa == //
bbb)
<< a << b;
llvm-svn: 238911
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
var aaaaa: List<SomeThing> = [
new SomeThingAAAAAAAAAAAA(),
new SomeThingBBBBBBBBB()
];
After:
var aaaaa: List<SomeThing> =
[new SomeThingAAAAAAAAAAAA(), new SomeThingBBBBBBBBB()];
llvm-svn: 238909
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before, this couldn't be formatted at all:
class X {
subs = {
'b': {
'c': 1,
},
};
}
llvm-svn: 238907
|
|
|
|
|
|
|
|
|
|
| |
Before:
return () =>[];
After:
return () => [];
llvm-svn: 238875
|
|
|
|
| |
llvm-svn: 238873
|
|
|
|
| |
llvm-svn: 238845
|
|
|
|
| |
llvm-svn: 238841
|
|
|
|
| |
llvm-svn: 238839
|
|
|
|
| |
llvm-svn: 238835
|
|
|
|
| |
llvm-svn: 238832
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
someFunction(() =>
{
doSomething(); // break
})
.doSomethingElse( // break
);
After:
someFunction(() => {
doSomething(); // break
})
.doSomethingElse( // break
);
This is still bad, but at least it is consistent with what we do for other
function literals. Added corresponding tests.
llvm-svn: 238736
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
let foo = {
[someLongKeyHere]: 1,
someOtherLongKeyHere: 2, [keyLongEnoughToWrap]: 3,
lastLongKey: 4
};
After:
let foo = {
[someLongKeyHere]: 1,
someOtherLongKeyHere: 2,
[keyLongEnoughToWrap]: 3,
lastLongKey: 4
};
llvm-svn: 238671
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
var x = {
[a]: 1,
b: 2
};
After:
var x = {
[a]: 1,
b: 2
};
llvm-svn: 238544
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
method expressions and array literals. They should not bind stronger
than regular parentheses or the braces of braced lists.
Specific test case in JavaScript:
Before:
var aaaaa: List<
SomeThing> = [new SomeThingAAAAAAAAAAAA(), new SomeThingBBBBBBBBB()];
After:
var aaaaa: List<SomeThing> = [
new SomeThingAAAAAAAAAAAA(),
new SomeThingBBBBBBBBB()
];
llvm-svn: 238400
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A definintion like this could not be formatted at all:
constructor({aa}: {
aa?: string,
aaaaaaaa?: string,
aaaaaaaaaaaaaaa?: boolean,
aaaaaa?: List<string>
}) {
}
llvm-svn: 238291
|
|
|
|
| |
llvm-svn: 238285
|
|
|
|
|
|
|
|
| |
instead of BinPackParameters. Braced lists are used as constructor
calls in many places and so the bin-packing should follow what is done
for other calls and not what is done for function declarations.
llvm-svn: 238184
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Specifically, don't add a space before it.
Before:
someFunction(... a);
var x = [1, 2, ... a];
After:
someFunction(...a);
var x = [1, 2, ...a];
llvm-svn: 238183
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes a case where the column limit was incorrectly calculated
leading to a macro like this:
#define A \
[] { \
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx( \
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); \
}
exceeding the column limit.
llvm-svn: 238182
|
|
|
|
|
|
|
|
|
|
|
|
| |
Assigns a token type (TT_JsFatArrow) to => tokens, and uses that to
more easily recognize and format fat arrow functions.
Improves function parsing to better recognize formal parameter
lists and return type declarations.
Recognizes arrow functions and parse function bodies as child blocks.
Patch by Martin Probst.
llvm-svn: 237895
|
|
|
|
|
|
|
|
|
| |
"void (*my_function)(void)" should become "void (*my_function) (void)" when
SpaceBeforeParens is set to 'Always'
Differential Revision: http://reviews.llvm.org/D9835
llvm-svn: 237704
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
S << a *(10);
After:
S << a * (10);
This fixes llvm.org/PR16500.
llvm-svn: 237690
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
for (SmallVectorImpl<TemplateIdAnnotationn *>::iterator I =
Container.begin(),
E = Container.end();
I != E; ++I)
After:
for (SmallVectorImpl<TemplateIdAnnotationn *>::iterator
I = Container.begin(),
E = Container.end();
I != E; ++I)
This fixes llvm.org/PR23544.
llvm-svn: 237688
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
#include_next < test.h >
After:
#include_next <test.h>
This fixes llvm.org/PR23500
llvm-svn: 237686
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
ns::E f() { return (ns::E) - 1; }
After:
ns::E f() { return (ns::E)-1; }
This fixes llvm.org/PR23503.
llvm-svn: 237684
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
[call aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.
aaaaaaaa];
After:
[call aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa
.aaaaaaaa];
This merely papers over the fact that we aren't parsing ObjC method calls
correctly. Also, the indentation is weird.
llvm-svn: 237681
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
class C : test {
class D : test{void f(){int i{2};
}
}
;
}
;
After:
class C : test {
class D : test {
void f() { int i{2}; }
};
};
llvm-svn: 237569
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
class C : public D {
SomeClass SC { 2 };
};
After:
class C : public D {
SomeClass SC{2};
};
llvm-svn: 237568
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
ASSERT("aaaaaaaaaaaaaaa")
<< aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
<< bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;
After:
ASSERT("aaaaaaaaaaaaaaa") << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
<< bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;
Also cleanup implementation a bit and only mark closing parenthesis of
these annotations.
llvm-svn: 237567
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
specializations.
Before:
template <class T>
struct S < std::is_arithmetic<T> {
} > {};
After:
template <class T> struct S<std::is_arithmetic<T>{}> {};
llvm-svn: 237565
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
DEPRECATED("Use NewClass::NewFunction instead.") string
OldFunction(const string ¶meter) {}
After:
DEPRECATED("Use NewClass::NewFunction instead.")
string OldFunction(const string ¶meter) {}
llvm-svn: 237562
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
NSString s = @"a"
"b"
"c";
NSString s = @"a"
@"b"
@"c";
After:
NSString s = @"a"
"b"
"c";
NSString s = @"a"
@"b"
@"c";
This fixes llvm.org/PR23536.
llvm-svn: 237538
|