| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
llvm-svn: 196929
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
llvm-svn: 196903
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
llvm-svn: 196864
|
|
|
|
|
|
|
|
| |
target_link_libraries() and LLVM_LINK_COMPONENTS.
I will prune redundant dependencies later.
llvm-svn: 196800
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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: 196380
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Added -fallback-style option. Changed clang-format to stop searching
for .clang-format when an invalid file is found.
Reviewers: djasper, klimek
Reviewed By: djasper
CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D2292
llvm-svn: 196108
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
llvm-svn: 195638
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
llvm-svn: 195253
|
|
|
|
|
|
|
|
|
|
|
|
| |
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: Pure refactoring, no semantic changes intended.
Reviewers: klimek
Reviewed By: klimek
CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D2220
llvm-svn: 195128
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
This fixes llvm.org/PR17842.
llvm-svn: 194268
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
popup_wdow_.reset([[RenderWidgetPopupWindow alloc]
iniithContentRect:
NSMakRet(origin_global.x, origin_global.y, pos.width(), pos.height())
syeMask:NSBorderlessWindowMask
bking:NSBackingStoreBuffered
der:NO]);
[self param:function( //
parameter)]
After:
popup_wdow_.reset([[RenderWidgetPopupWindow alloc]
iniithContentRect:NSMakRet(origin_global.x, origin_global.y, pos.width(),
pos.height())
syeMask:NSBorderlessWindowMask
bking:NSBackingStoreBuffered
der:NO]);
[self param:function( //
parameter)]
llvm-svn: 194267
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
[self // break
a:a
aa:aa
aaaaa:aaa];
After:
[self // break
a:a
aa:aa
aaaaa:aaa];
llvm-svn: 194241
|
|
|
|
| |
llvm-svn: 194229
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
#define M(NAME) assert(!Context.Verifying &&#NAME);
After:
#define M(NAME) assert(!Context.Verifying && #NAME);
This fixes llvm.org/PR16156.
llvm-svn: 194216
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
[self aaaaaaaaaaaaaaa:aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa |
aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa |
aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa];
[self aaaaaaaaaaaaaaa:aaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa];
After:
[self aaaaaaaaaaaaaaa:aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa |
aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa |
aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa];
[self aaaaaaaaaaaaaaa:aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa];
This addresses llvm.org/PR15349 and llvm.org/PR16185.
llvm-svn: 194214
|