| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
| |
Before:
return [ i, args... ]{};
After:
return [i, args...] {};
llvm-svn: 210514
|
|
|
|
|
|
|
| |
With AlwaysSplitBeforeMultilineStrings, clang-format would not find any
valid solution.
llvm-svn: 210513
|
|
|
|
| |
llvm-svn: 210448
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before (JavaScript example, but can extend to other languages):
return {
a: 'E',
b: function() {
return function() {
f(); // This is wrong.
};
}
};
After:
return {
a: 'E',
b: function() {
return function() {
f(); // This is better.
};
}
};
llvm-svn: 210334
|
|
|
|
|
|
|
|
| |
These are commonly used to structure things like enums or long braced
lists. There doesn't seem to be a good reason to have the behavior in
such structures be different from the behavior between statements.
llvm-svn: 210183
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes a few oddities when formatting multiple nested JavaScript
blocks, e.g.:
Before:
promise.then(
function success() {
doFoo();
doBar();
},
[], function error() {
doFoo();
doBaz();
});
promise.then([],
function success() {
doFoo();
doBar();
},
function error() {
doFoo();
doBaz();
});
After:
promise.then(
function success() {
doFoo();
doBar();
},
[],
function error() {
doFoo();
doBaz();
});
promise.then([],
function success() {
doFoo();
doBar();
},
function error() {
doFoo();
doBaz();
});
llvm-svn: 210097
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There is a pattern where evaluation order is used as control flow.
This patch special-cases a commonly occuring version of this pattern.
Before:
Aaaaa *aaa = nullptr;
// ...
aaa &&aaa->f();
After:
Aaaaa *aaa = nullptr;
// ...
aaa && aaa->f();
llvm-svn: 210017
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
auto j = decltype(i) {};
After:
auto j = decltype(i){};
This fixes llvm.org/PR19892.
llvm-svn: 210013
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
enum Side
{ LEFT,
RIGHT };
After:
enum Side
{
LEFT,
RIGHT
};
This fixes llvm.org/PR19911.
llvm-svn: 210011
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
void someLongFunction(int someLongParameter)
const
{
}
After:
void someLongFunction(
int someLongParameter) const
{
}
This fixes llvm.org/PR19912.
llvm-svn: 210010
|
|
|
|
|
|
|
| |
There is no std::error_code::success, so this removes much of the noise
in transitioning to std::error_code.
llvm-svn: 209949
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before (with just the right line length:
switch (a) {
case some_namespace::some_constant
:
return;
}
After:
switch (a) {
case some_namespace::
some_constant:
return;
}
llvm-svn: 209725
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Especially, reduce the amount of indentation if it doesn't increase
readability.
Before:
NSMutableDictionary* dictionary = [NSMutableDictionary
dictionaryWithDictionary:@{
aaaaaaaaaaaaaaaaaaaaa : aaaaaaaaaaaaa,
bbbbbbbbbbbbbbbbbb : bbbbb,
cccccccccccccccc : ccccccccccccccc
}];
After:
NSMutableDictionary* dictionary =
[NSMutableDictionary dictionaryWithDictionary:@{
aaaaaaaaaaaaaaaaaaaaa : aaaaaaaaaaaaa,
bbbbbbbbbbbbbbbbbb : bbbbb,
cccccccccccccccc : ccccccccccccccc
}];
llvm-svn: 209720
|
|
|
|
|
|
| |
No functional changes intended.
llvm-svn: 209626
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
void f()
{
[object
someMethod:@
{ @"a" : @"b" }];
}
After:
void f()
{
[object someMethod:@{ @"a" : @"b" }];
}
This fixes llvm.org/PR19854.
llvm-svn: 209615
|
|
|
|
| |
llvm-svn: 209477
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
And "none" pseudo-style indicating that formatting should be not
applied.
(1) Using .clang-format with "DisableFormat: true" effectively prevents
formatting for all files within the folder containing such .clang-format
file.
(2) Using -fallback-style=none together with -style=file prevents
formatting when .clang-format is not found, which can be used in on-save
callback.
Patch by Adam Strzelecki. Thank you!
llvm-svn: 209446
|
|
|
|
|
|
| |
It just seems wrong. This fixes llvm.org/PR19736.
llvm-svn: 209440
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
template <int> struct A4 { A4() { }
};
After:
template <int i> struct A4 {
A4() {}
};
This fixes llvm.org/PR19813 (at least the part that isn't working as
intended).
llvm-svn: 209438
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
static_assert(std::is_integral<int> {} + 0, "");
int a = std::is_integral<int> {}
+ 0;
After:
static_assert(std::is_integral<int>{} + 0, "");
int a = std::is_integral<int>{} + 0;
llvm-svn: 209431
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
int foo(int i) {
return fo1 {}
(i);
}
int foo(int i) {
return fo1 {}
(i);
}
After:
int foo(int i) { return fo1{}(i); }
int foo(int i) { return fo1{}(i); }
This fixes llvm.org/PR19812.
llvm-svn: 209428
|
|
|
|
|
|
|
|
|
|
|
| |
As the memory ownership is handled by the SpecificBumpPtrAllocator
anyway, there is no need to duplicate states when inserting them into
the Seen-set. This leads to an improvement of ~10% on the benchmark
formatting file.
No functional changes intended.
llvm-svn: 209422
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
var literal = 'hello ' + 'world';
After:
var literal = 'hello ' +
'world';
There is no reason to concatenated two string literals with a '+' unless
the line break is intended.
llvm-svn: 209413
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
int i{a *b};
After:
int i{a * b};
Also fix unrelated issue where braced init lists were counted as blocks
and prevented single-line functions.
llvm-svn: 209412
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If simple (one-statement) blocks can be inlined, the length needs to be
calculated correctly.
Before (in JavaScript but this also affects lambdas, etc.):
var x = {
valueOf: function() { return 1; }
};
After:
var x = {valueOf: function() { return 1; }};
llvm-svn: 209410
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
var object_literal_with_long_name = {
a: 'aaaaaaaaaaaaaaaaaa', b: 'bbbbbbbbbbbbbbbbbb'
};
After:
var object_literal_with_long_name = {
a: 'aaaaaaaaaaaaaaaaaa',
b: 'bbbbbbbbbbbbbbbbbb'
};
llvm-svn: 209296
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In:
struct A {
A()
noexcept(....) {}
};
'A()' is not a macro call.
This fixes llvm.org/PR19814.
llvm-svn: 209294
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
goog.array.forEach(array, function() {
doSomething();
doSomething();
},
this);
After:
goog.array.forEach(array, function() {
doSomething();
doSomething();
}, this);
llvm-svn: 209291
|
|
|
|
| |
llvm-svn: 209205
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
[self.x a:b c:d];
Got reformatted toi (with ColumnLimit set to 0):
[self.x a:b
c:d];
llvm-svn: 209114
|
|
|
|
|
|
|
|
|
|
| |
Before:
var[a, b, c] = [1, 2, 3];
After:
var [a, b, c] = [1, 2, 3];
llvm-svn: 209113
|
|
|
|
|
|
|
|
|
|
| |
Before:
var b = a.map((x) = > x + 1);
After:
var b = a.map((x) => x + 1);
llvm-svn: 209112
|
|
|
|
| |
llvm-svn: 208838
|
|
|
|
|
|
|
|
|
| |
With AllowShortBlocksOnASingleLine, clang-format allows:
if (a) { return; }
Based on patch by Gonzalo BG, thank you!
llvm-svn: 208765
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
zzzzzzzzzz = bbbbbbbbbbbbbbbbb >
> aaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaa);
After:
zzzzzzzzzz
= bbbbbbbbbbbbbbbbb
>> aaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaa);
This fixes llvm.org/PR19731.
llvm-svn: 208672
|
|
|
|
|
|
|
|
|
|
| |
Before:
var regex = /\\/ g; // This isn't even recognized as regex.
After:
var regex = /\\/g; // It now is.
llvm-svn: 208539
|
|
|
|
|
|
|
| |
Required pulling LambdaExpr::Capture into its own header.
No functionality change.
llvm-svn: 208470
|
|
|
|
|
|
| |
Also run clang-format over clang-format's files.
llvm-svn: 208409
|
|
|
|
| |
llvm-svn: 208404
|
|
|
|
|
|
|
|
|
|
| |
Before:
someVariable = {'a':[{}]};
After:
someVariable = {'a': [{}]};
llvm-svn: 208403
|
|
|
|
| |
llvm-svn: 208392
|
|
|
|
|
|
| |
No functional changes intended.
llvm-svn: 208304
|
|
|
|
|
|
|
|
|
|
| |
Most of this patch was created by Alexander Rojas in
http://reviews.llvm.org/D2555
Thank you!
Synced and addressed review comments.
llvm-svn: 208302
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
return {body: {setAttribute: function(key, val) {this[key] = val;
}
, getAttribute : function(key) { return this[key]; }
, style : {
direction:
''
}
}
}
;
After:
return {
body: {
setAttribute: function(key, val) { this[key] = val; },
getAttribute: function(key) { return this[key]; },
style: {direction: ''}
}
};
llvm-svn: 208292
|
|
|
|
|
|
|
|
|
|
| |
Before:
bool foo = true&& [] { return false; }();
After:
bool foo = true && [] { return false; }();
llvm-svn: 208288
|
|
|
|
| |
llvm-svn: 208285
|
|
|
|
| |
llvm-svn: 208281
|
|
|
|
|
|
| |
Patch by Bobby Moretti.
llvm-svn: 208269
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
So that JS functions can also be merged into a single line.
Before:
var func = function() {
return 1;
};
After:
var func = function() { return 1; };
llvm-svn: 208176
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
if ( // a
x + 3) { ..
After:
if ( // a
x + 3) { ..
llvm-svn: 208175
|