| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
| |
Among other things, this fixes llvm.org/PR15269.
llvm-svn: 197900
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
SomeFunction(L"A" L"B");
After:
SomeFunction(L"A"
L"B");
llvm-svn: 197785
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A comment following the "{" of a braced list seems to almost always
refer to the first element of the list and thus should be aligned
to it.
Before (with Cpp11 braced list style):
SomeFunction({ // Comment 1
"first entry",
// Comment 2
"second entry"});
After:
SomeFunction({// Comment 1
"first entry",
// Comment 2
"second entry"});
llvm-svn: 197725
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Unexpectedly, it seems that people commonly know what they were doing
when writing a comment.
Also, being more conservative about comment breaking has the advantage
of giving more flexibility. If a linebreak within the comment can
improve formatting, the author can add it (after which clang-format
won't undo it). There is no way to override clang-format's behavior if
it breaks a comment.
llvm-svn: 197698
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
Diag(aaaaaaaaaaaaaaaaaaaa, aaaaaaaa) << aaaaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaa);
After:
Diag(aaaaaaaaaaaaaaaaaaaa, aaaaaaaa)
<< aaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaa);
llvm-svn: 197690
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
aaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
aaaaaaaaaa = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa();
After:
aaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
aaaaaaaaaa = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa();
Probably still not ideal, but should be a step into the right direction.
llvm-svn: 197557
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
bool a = ([aaaaaaaa aaaaa] == aaaaaaaaaaaaaaaaa || [aaaaaaaa aaaaa] ==
aaaaaaaaaaaaaaaaaaaa);
After:
bool a = ([aaaaaaaa aaaaa] == aaaaaaaaaaaaaaaaa ||
[aaaaaaaa aaaaa] == aaaaaaaaaaaaaaaaaaaa);
This fixes llvm.org/PR18271.
llvm-svn: 197552
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Formatting this:
void f() { // 1 space initial indent.
int i;
#define A \
int i; \
int j;
int k; // Format this line.
}
void f() {
#define A 1 // Format this line.
}
Before:
void f() { // 1 space initial indent.
int i;
#define A \
int i; \
int j;
int k; // Format this line.
}
void f() {
#define A 1 // Format this line.
}
After:
void f() { // 1 space initial indent.
int i;
#define A \
int i; \
int j;
int k; // Format this line.
}
void f() {
#define A 1 // Format this line.
}
llvm-svn: 197494
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
virtual void aaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaa aaaa, aaaaaaaaaaa aaaaa) const
override;
virtual void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() const
override;
After:
virtual void aaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaa aaaa,
aaaaaaaaaaa aaaaa) const override;
virtual void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa()
const override;
llvm-svn: 197391
|
|
|
|
|
|
|
|
|
|
|
| |
BreakConstructorInitializersBeforeComma is true.
This option is used in WebKit style, so this also ensures initializer lists are
not put on a single line, as per the WebKit coding guidelines.
Patch by Florian Sowade!
llvm-svn: 197386
|
|
|
|
|
|
|
|
|
| |
Before:
void f() { typedef void (*f)(int * a); }
After:
void f() { typedef void (*f)(int *a); }
llvm-svn: 197369
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Especially try to keep existing line breaks before raw string literals,
as the code author might have aligned content to it.
Thereby, clang-format now keeps things like:
parseStyle(R"(
BasedOnStyle: Google,
ColumnLimit: 100)");
parseStyle(
R"(BasedOnStyle: Google,
ColumnLimit: 100)");
llvm-svn: 197368
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Added BraceBreakingStyle::BS_GNU. I'm not sure about the correctness of
static initializer formatting, but compound statements should be fine.
Reviewers: djasper
Reviewed By: djasper
CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D2372
llvm-svn: 197138
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This still misses a few important features, so there's no mention of
this style in the help message, but a few style rules are implemented.
Reviewers: djasper
Reviewed By: djasper
CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D2371
llvm-svn: 196928
|
|
|
|
|
|
| |
CMakeLists.txt.
llvm-svn: 196916
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Allow predefined styles to define different options for different
languages so that one can run:
clang-format -style=google file1.cpp file2.js
or use a single .clang-format file with "BasedOnStyle: Google" for both c++ and
JS files.
Added Google style for JavaScript with "BreakBeforeTernaryOperators" set to
false.
Reviewers: djasper
Reviewed By: djasper
CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D2364
llvm-svn: 196909
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
The rule from the GNU style states:
"We find it easier to read a program when it has spaces before the open-parentheses and after the commas."
http://www.gnu.org/prep/standards/standards.html#index-spaces-before-open_002dparen
This patch makes clang-format adds an option to put spaces before almost all open parentheses, except the cases, where different behavior is dictated by the style rules or language syntax:
* preprocessor:
** function-like macro definitions can't have a space between the macro name and the parenthesis;
** `#if defined(...)` can have a space, but it seems, that it's more frequently used without a space in GCC, for example;
* never add spaces after unary operators;
* adding spaces between two opening parentheses is controlled with the `SpacesInParentheses` option;
* never add spaces between `[` and `(` (there's no option yet).
Reviewers: djasper
Reviewed By: djasper
CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D2326
llvm-svn: 196901
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Specifically disable it for nested braced lists as it commonly can look
really weird. Eventually, we'll want to become smarter and format some of
the nested lists better.
Before:
SomeStruct my_struct_array = {
{ aaaaaa, aaaaaaaa, aaaaaaaaaa, aaaaaaaaa, aaaaaaaaa,
aaaaaaaaaa, aaaaaaaaaa, aaaaaaa, aaa },
{ aaaa, aaaa, aaaa, aaaa, aaaa, aaaa, aaaa, aaa },
{ aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaa, a, aaaaaaaaaa,
aaaaaaaaa, aaa },
};
After:
SomeStruct my_struct_array = {
{ aaaaaa, aaaaaaaa, aaaaaaaaaa, aaaaaaaaa, aaaaaaaaa, aaaaaaaaaa,
aaaaaaaaaaaa, aaaaaaa, aaa },
{ aaaa, aaaa, aaaa, aaaa, aaaa, aaaa, aaaa, aaa },
{ aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaa, a, aaaaaaaaaa, aaaaaaaaa, aaa },
};
llvm-svn: 196783
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<int> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
[aaaaaaaaaaaa];
After:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<int>
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[aaaaaaaaaaaa];
llvm-svn: 196582
|
|
|
|
| |
llvm-svn: 196510
|
|
|
|
| |
llvm-svn: 196384
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Allow tryFitMultipleLinesInOne join unwrapped lines when
ContinuationIndenter::mustBreak doesn't agree. But don't merge any lines, that
are separate in the input.
Reviewers: djasper
Reviewed By: djasper
CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D2321
llvm-svn: 196378
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: djasper
Reviewed By: djasper
CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D2307
llvm-svn: 196266
|
|
|
|
|
|
|
| |
Due to a bug in the patch, clang-format would more or less simply format
all multi-line comments.
llvm-svn: 196080
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Use LS_JavaScript for files ending with ".js". Added support for ">>>="
operator.
Reviewers: djasper, klimek
Reviewed By: djasper
CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D2242
llvm-svn: 195961
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
int aaaa; // This line is formatted.
// The comment continues ..
// .. here.
Before:
int aaaa; // This line is formatted.
// The comment continues ..
// .. here.
This fixes llvm.org/PR17914.
llvm-svn: 195954
|
|
|
|
|
|
| |
This should fix llvm.org/PR17241. Maybe it sticks this time :-).
llvm-svn: 195953
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
DEBUG( //
{ f(); });
After:
DEBUG( //
{ f(); });
Also add additional test to selected formatting of individual statements
in nested blocks.
llvm-svn: 195952
|
|
|
|
|
|
|
|
|
|
| |
Previously, clang-format could create quite corrupt formattings if
individual lines of nested blocks (e.g. in "DEBUG({})" or lambdas) were
used. With this patch, it tries to extend the formatted regions to leave
around some reasonable format without always formatting the entire
surrounding statement.
llvm-svn: 195925
|
|
|
|
|
|
| |
Apparently, not all tools display non-printable characters ;)
llvm-svn: 195761
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
getStringSplit used to crash, when trying to split a long string
literal containing both printable and unprintable multi-byte UTF-8 characters.
Reviewers: djasper, klimek
Reviewed By: djasper
CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D2268
llvm-svn: 195728
|
|
|
|
|
|
|
|
| |
No functional changes intended. However, it seems to have found a buggy
behavior in one of the tests. I think this structure is generally
desirable and it will make a planned bugfix significantly easier.
llvm-svn: 195634
|
|
|
|
|
|
| |
This fixes llvm.org/PR17241.
llvm-svn: 195555
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes llvm.org/PR17979.
Before:
void f() { g(/*aaa=*/x, /*bbb=*/ !y); }
After:
void f() { g(/*aaa=*/x, /*bbb=*/!y); }
llvm-svn: 195553
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With Style.BreakBeforeBinaryOperators, clang-format breaks incorrectly.
This fixes llvm.org/PR17994.
Before:
return boost::fusion::at_c<0>(iiii).second == boost::fusion::at_c
<1>(iiii).second;
After:
return boost::fusion::at_c<0>(iiii).second ==
boost::fusion::at_c<1>(iiii).second;
llvm-svn: 195552
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Also disallow breaking between "@" and "{" or "[".
Before:
- (NSAttributedString *)attributedStringForSegment:(NSUInteger)segment
index:(NSUInteger)index
attributes:(NSDictionary *)attributes
nonDigitAttributes:(NSDictionary *)
nonDigitAttributes;
[mailComposeViewController
setToRecipients:@
[ NSBundle.mainBundle.infoDictionary[@"ABBFeedbackEmail"] ]];
After:
- (NSAttributedString *)attributedStringForSegment:(NSUInteger)segment
index:(NSUInteger)index
attributes:(NSDictionary *)attributes
nonDigitAttributes:
(NSDictionary *)nonDigitAttributes;
[mailComposeViewController
setToRecipients:
@[ NSBundle.mainBundle.infoDictionary[@"ABBFeedbackEmail"] ]];
This fixes llvm.org/PR18030.
llvm-svn: 195550
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add a severe penalty for not using column layout for braced lists. If
there are solutions with column layout, these are generally preferable
over bin-packed solutions.
Before:
std::vector<MyValues> aaaaaaaaaaaaaaaaaaa{ aaaaaaa, aaaaaaaaaa, aaaaa,
aaaaaaaaaaaaaaa, aaa, aaaaaaaaaa, a,
aaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaa,
aaaaaaaaaaaaaaaaaaa +
aaaaaaaaaaaaaaaaaaa,
aaaaaaa, a };
After:
std::vector<MyValues> aaaaaaaaaaaaaaaaaaa{
aaaaaaa, aaaaaaaaaa,
aaaaa, aaaaaaaaaaaaaaa,
aaa, aaaaaaaaaa,
a, aaaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaa,
aaaaaaa, a
};
llvm-svn: 195546
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
template <typename aaaaaaaaaaa, typename bbbbbbbbbbbbb, template <typename>
class cccccccccccccccccccccc, typename ddddddddddddd>
class C {};
After:
template <typename aaaaaaaaaaa, typename bbbbbbbbbbbbb,
template <typename> class cccccccccccccccccccccc,
typename ddddddddddddd>
class C {};
llvm-svn: 195418
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
int count = set<int> { f(), g(), h() }
.size();
After:
int count = set<int>{f(), g(), h()}.size();
llvm-svn: 195417
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Now based on token merging. Now they are not only prevented from being
split, but are actually formatted as comparison operators.
Reviewers: djasper, klimek
Reviewed By: klimek
CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D2240
llvm-svn: 195354
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In particular, make breaking after a parameter's ":" more of a last
resort choice as it significantly affects the readability gained by
aligning the parameters.
Before (in Chromium style - which doesn't allow bin-packing):
{
popup_window_.reset([[RenderWidgetPopupWindow alloc]
initWithContentRect:
NSMakeRect(
origin_global.x, origin_global.y, pos.width(), pos.height())
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered
defer:NO]);
}
After:
{
popup_window_.reset([[RenderWidgetPopupWindow alloc]
initWithContentRect:NSMakeRect(origin_global.x,
origin_global.y,
pos.width(),
pos.height())
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered
defer:NO]);
}
llvm-svn: 195301
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
The AllowShortFunctionsOnASingleLine option now controls short function
body placement on a single line independent of the BreakBeforeBraces option.
Updated tests using BreakBeforeBraces other than BS_Attach.
Addresses http://llvm.org/PR17888
Reviewers: klimek, djasper
Reviewed By: klimek
CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D2230
llvm-svn: 195256
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: klimek, djasper
Reviewed By: klimek
CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D2231
llvm-svn: 195251
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
void f() {
CHECK_EQ(aaaa, (
*bbbbbbbbb)->cccccc)
<< "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq";
}
After:
void f() {
CHECK_EQ(aaaa, (*bbbbbbbbb)->cccccc)
<< "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq";
}
llvm-svn: 195240
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: Fixes http://llvm.org/PR17753
Reviewers: klimek
Reviewed By: klimek
CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D2159
llvm-svn: 194576
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: Solves the problem described in http://llvm.org/PR17756
Reviewers: klimek
Reviewed By: klimek
CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D2131
llvm-svn: 194493
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
directives.
Summary: This solves http://llvm.org/PR17536
Reviewers: klimek, djasper
Reviewed By: klimek
CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D2142
llvm-svn: 194491
|
|
|
|
|
|
|
|
| |
This used to interfere with AlwaysBreakBeforeMultilineStrings.
This fixes llvm.org/PR17856.
llvm-svn: 194310
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before, existing code in the form of:
int a; // this is a.
// This is
// b.
int b;
Got turned into:
int a; // this is a.
// This is
// b.
int b;
llvm-svn: 194294
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
unsigned ContentSize =
sizeof(int16_t) // DWARF ARange version number
+
sizeof(int32_t) // Offset of CU in the .debug_info section
+
sizeof(int8_t) // Pointer Size (in bytes)
+
sizeof(int8_t); // Segment Size (in bytes)
After:
unsigned ContentSize =
sizeof(int16_t) // DWARF ARange version number
+ sizeof(int32_t) // Offset of CU in the .debug_info section
+ sizeof(int8_t) // Pointer Size (in bytes)
+ sizeof(int8_t); // Segment Size (in bytes)
This fixes llvm.org/PR17687.
llvm-svn: 194276
|