| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: djasper
Reviewed By: djasper
CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D3110
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204156 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Due to not resetting the fake rparen data on the token when iterating
over annotated lines, we would pop the last element of the paren stack.
This patch fixes the underlying root cause, and makes the code more
robust against similar problems in the future:
- reset the first token when iterating on the same annotated lines due
to preprocessor branches
- never pop the last element from the paren stack, so we do not crash,
but rather incorrectly format
- add assert()s so we can figure out if our assumptions are violated
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204140 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
@{
NSFontAttributeNameeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee :
regularFont,
};
After:
@{
NSFontAttributeNameeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee :
regularFont,
};
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204041 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This was leading to bad formatting, e.g.:
Before:
f(^{
@autoreleasepool {
if (a) {
g();
}
}
});
After:
f(^{
@autoreleasepool {
if (a) {
g();
}
}
});
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203777 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
| |
Caused by unknown tokens (e.g. "\n") not properly updating the state.
Example:
const char* c = STRINGIFY(
\na : b);
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203645 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
auto aaaaaaaa = [](int i, // break
int j)
-> int {
return fffffffffffffffffffffffffffffffffffffff(i * j);
};
After:
auto aaaaaaaa = [](int i, // break
int j) -> int {
return fffffffffffffffffffffffffffffffffffffff(i * j);
};
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203562 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
| |
Before:
int i = (*b)[a] -> f();
After:
int i = (*b)[a]->f();
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203557 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
| |
Before:
int i = a[a][a] -> f();
After:
int i = a[a][a]->f();
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203556 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
void f() {
MACRO((const AA & a) { return 1; });
}
After:
void f() {
MACRO((const AA &a) { return 1; });
}
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203551 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
void f() {
bar([]() {}// Does not respect SpacesBeforeTrailingComments
);
}
After:
void f() {
bar([]() {} // Does not respect SpacesBeforeTrailingComments
);
}
This fixes llvm.org/PR19017.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203466 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
If we need to break the second line here:
// something: aaaaa aaaaa aaaaaa aaaaa aaaaa
// aaaaa aaaaa aaaaaa aaaaa aaaaa aaaaa
with the patch it will be turned to
// something: aaaaa aaaaa aaaaaa aaaaa aaaaa
// aaaaa aaaaa aaaaaa aaaaa aaaaa
// aaaaa
instead of
// something: aaaaa aaaaa aaaaaa aaaaa aaaaa
// aaaaa aaaaa aaaaaa aaaaa aaaaa
// aaaaa
Reviewers: djasper, klimek
Reviewed By: klimek
CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D2988
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203458 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
| |
Before:
int c = []()->int { return 2; }();
After:
int c = []() -> int { return 2; }();
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203452 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
| |
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203123 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
| |
init list formatting. This suggestion has now gone into the LLVM coding
standards, and is particularly relevant now that we're using C++11.
Updated a really ridiculous number of tests to reflect this change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202637 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Generally people seem to prefer wrapping the first function parameter
over wrapping the trailing tokens "const", "override" and "final". This
does not extend to function-like annotations and probably not to other
non-standard annotations.
Before:
void someLongFunction(int SomeLongParameter)
const { ... }
After:
void someLongFunction(
int SomeLongParameter) const { ... }
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201504 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
template <class R, class C>
struct Aaaaaaaaaaaaaaaaa<R (C::*)(int)
const> : Aaaaaaaaaaaaaaaaa<R (C::*)(int)> {};
After:
template <class R, class C>
struct Aaaaaaaaaaaaaaaaa<R (C::*)(int) const>
: Aaaaaaaaaaaaaaaaa<R (C::*)(int)> {};
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201424 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
| |
E.g.:
Foo([]()->std::vector<int> { return { 2 }; }());
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201139 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
auto result = SomeObject
// Calling someFunction on SomeObject
.someFunction();
After:
auto result = SomeObject
// Calling someFunction on SomeObject
.someFunction();
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201138 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before (81 columns):
#define A \
void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() { return aaaaaaaa; } \
int i;
After:
#define A \
void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() { \
return aaaaaaaa; \
} \
int i;
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200974 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
for (aaaaaaaaa aaaaaaaaaaaaaaaaaaaaa : aaaaaaaaaaaa.aaaaaaaaaaaa()
.aaaaaaaaa()
.a()) {
}
After:
for (aaaaaaaaa aaaaaaaaaaaaaaaaaaaaa :
aaaaaaaaaaaa.aaaaaaaaaaaa().aaaaaaaaa().a()) {
}
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200968 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It seems like most people see unary operators more like part of the
subsequent identifier and find relative indentation odd.
Before:
aaaaaaaaaa(!aaaaaaaaaa( // break
aaaaa));
After:
aaaaaaaaaa(!aaaaaaaaaa( // break
aaaaa));
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200840 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
| |
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200652 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
| |
Before, this would lead to a crash:
f('', true);
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200540 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
typedef NS_ENUM(NSInteger, MyType) {
/// Information about someDecentlyLongValue.
someDecentlyLongValue,
/// Information about anotherDecentlyLongValue.
anotherDecentlyLongValue,
/// Information about aThirdDecentlyLongValue.
aThirdDecentlyLongValue};
After:
typedef NS_ENUM(NSInteger, MyType) {
/// Information about someDecentlyLongValue.
someDecentlyLongValue,
/// Information about anotherDecentlyLongValue.
anotherDecentlyLongValue,
/// Information about aThirdDecentlyLongValue.
aThirdDecentlyLongValue
};
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200469 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
repeated double value = 1 [(aaaaaaa.aaaaaaaaa) = {
aaaaaaaaaaaaaaaa : AAAAAAAAAA,
bbbbbbbbbbbbbbbb : BBBBBBBBBB
}];
After:
repeated double value = 1
[(aaaaaaa.aaaaaaaaa) = {aaaaaaaaaaaaaaaa : AAAAAAAAAA,
bbbbbbbbbbbbbbbb : BBBBBBBBBB}];
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200406 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
repeated double value = 1 [(aaaaaaa.aaaaaaaaa) = {
aaaaaaaaaaaaaaaaa : AAAAAAAA
}];
After:
repeated double value = 1
[(aaaaaaa.aaaaaaaaa) = {aaaaaaaaaaaaaaaaa : AAAAAAAA}];
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200405 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
| |
The following snippet would crash:
#endif
#if A
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200381 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
ReturnType __attribute__((unused))
function(int i);
After:
ReturnType __attribute__((unused))
function(int i);
This fixes llvm.org/PR18632.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200337 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
| |
Before:
optional int32 foo[ default = true, deprecated = true ];
After:
optional int32 foo[default = true, deprecated = true];
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200327 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
| |
Mozilla and WebKit seem to use a space after @property (verified by
grepping their codebases) so we turn this on there as well.
Change by Christian Legnitto. Thank you!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200320 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
Deleted &operator=(const Deleted &)&= default;
Deleted &operator=(const Deleted &)&&= delete;
After:
Deleted &operator=(const Deleted &)& = default;
Deleted &operator=(const Deleted &)&& = delete;
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200073 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
| |
This was done when we were not able to parse lambdas to handle some
edge cases for block formatting different in return statements, but is
not necessary any more.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199982 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
std::unique_ptr<int[]> foo() {}
After:
std::unique_ptr<int []> foo() {}
Also, the formatting could go severely wrong after such a function
before.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199817 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
optional really.really.long.and.qualified.type.aaaaaaa
.aaaaaaaa another_fiiiiiiiiiiiiiiiiiiiiield = 2;
After:
optional
really.really.long.and.qualified.type.aaaaaaa.aaaaaaaa
another_fiiiiiiiiiiiiiiiiiiiiield = 2;
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199796 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
| |
Before:
#if AAAA &&BBBB
After:
#if AAAA && BBBB
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199713 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
| |
Before:
option(my_option) = "abc";
After:
option (my_option) = "abc";
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199672 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
| |
With this patch, there is dedicated testing for protocol buffers
(https://developers.google.com/protocol-buffers/).
Also some minor tweaks formatting tweaks.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199580 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
| |
Before:
foo (^{ bar(); });
After:
foo(^{ bar(); });
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199573 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
| |
The author might be missing the "#" or these might be protocol buffer
definitions. Either way, we should not break the line or the string.
There don't seem to be other valid use cases.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199501 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
| |
Before:
int a = [operation block:^int(int * i) { return 1; }];
After:
int a = [operation block:^int(int *i) { return 1; }];
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199411 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
| |
So clang-format can now format:
int c = []()->int { return 2; }();
int c = []()->vector<int> { return { 2 }; }();
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199368 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
var arr = [ 1, 2, 3 ];
var obj = {a : 1, b : 2, c : 3};
After:
var arr = [1, 2, 3];
var obj = {a: 1, b: 2, c: 3};
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199317 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
|
|
| |
We cannot simply change the start column to accomodate for the @ in an
ObjC string literal as that will make clang-format happily violate the
column limit.
Use a different workaround instead. However, a better long-term
solution might be to join the @ and the rest of the literal into a
single token.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199198 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Formatting:
Constructor() :
// Comment forcing unwanted break.
aaaa(aaaa) {}
Before:
Constructor()
:
// Comment forcing unwanted break.
aaaa(aaaa) {}
After:
Constructor()
: // Comment forcing unwanted break.
aaaa(aaaa) {}
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199107 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
SomeThing // break
.SomeFunction( // break
param);
After:
SomeThing // break
.SomeFunction( // break
param);
Seems to be more common in editors and codebases I have looked at.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199105 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
SomeMap[std::pair(aaaaaaaaaaaa, bbbbbbbbbbbbbbb)]
.insert(ccccccccccccccccccccccc);
After:
SomeMap[std::pair(aaaaaaaaaaaa, bbbbbbbbbbbbbbb)].insert(
ccccccccccccccccccccccc);
This seems to be about 3:1 more common in Google and Chromium style and I found
only a handful of instances inside the LLVM codebase.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198924 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
| |
Before:
[dictionary setObject:@(1)forKey:@"number"];
After:
[dictionary setObject:@(1) forKey:@"number"];
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198920 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
| |
While it is allowed to not have an @ on subsequent lines, it seems
general practice to add them. If undesired, the code author can easily
remove them again and clang-format won't re-add them.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198871 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
| |
Before:
#pragma mark Any non - hyphenated or hyphenated string(including parentheses).
After:
#pragma mark Any non-hyphenated or hyphenated string (including parentheses).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198870 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
| |
- Format a braced list with one element per line if it has nested
braced lists.
- Use a column layout only when the list has 6+ elements (instead of the
current 4+ elements).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198869 91177308-0d34-0410-b5e6-96231b3b80d8
|