| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
before it is not a closing parenthesis.
Otherwise, this frequently leads to "hanging" indents that users
perceive as "weird".
Before:
return !soooooooooooooome_map.insert(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
.second;
After:
return !soooooooooooooome_map
.insert(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
.second;
llvm-svn: 254933
|
|
|
|
| |
llvm-svn: 254414
|
|
|
|
|
|
| |
Patch by Alexander Richardson, thank you!
llvm-svn: 254407
|
|
|
|
|
|
|
|
|
|
|
| |
misalignments like the following:
int a, b = 2;
int c = 3;
Patch by Beren Minor, thanks!
llvm-svn: 254406
|
|
|
|
| |
llvm-svn: 253900
|
|
|
|
|
|
|
|
|
|
| |
Before:
bool b = f(g<int>)&&c;
After:
bool b = f(g<int>) && c;
llvm-svn: 253872
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
multiple lines, also break before the variable name.
Before:
std::vector<aaaaaa, // wrap
aa> aaa;
After:
std::vector<aaaaaa, // wrap
aa>
aaa;
llvm-svn: 253871
|
|
|
|
| |
llvm-svn: 253860
|
|
|
|
| |
llvm-svn: 253772
|
|
|
|
|
|
| |
work properly.
llvm-svn: 253674
|
|
|
|
| |
llvm-svn: 253672
|
|
|
|
| |
llvm-svn: 253671
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
MACRO(> );
After:
MACRO(>);
Not overly important, but easy and good for symmetry reasons :-).
llvm-svn: 253669
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
extend.foo.Bar {
}
After:
extend .foo.Bar {
}
llvm-svn: 253667
|
|
|
|
|
|
|
|
|
| |
This has seen quite some usage and I am not aware of any issues. Also
add a style option to enable/disable include sorting. The existing
command line flag can from now on be used to override whatever is set
in the style.
llvm-svn: 253202
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
unaffected lines with incorrect initial indent.
Starting from:
namespace {
int i; // There shouldn't be indentation here.
int j; // <- call clang-format on this line.
}
Before:
namespace {
int i;
int j;
}
After:
namespace {
int i;
int j;
}
llvm-svn: 251824
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
after a change. With r251474, clang-format could indent the entire rest of the file, if there is a missing closing brace, e.g. while writing code in an editor.
Summary:
With this change, clang-format stops formatting when either it leaves
the current scope or when it comes back to the initial scope after
going into a nested one.
Reviewers: klimek
Subscribers: cfe-commits, klimek
Differential Revision: http://reviews.llvm.org/D14213
llvm-svn: 251760
|
|
|
|
|
|
|
|
| |
Correct handling for C++17 inline namespaces. We would previously fail to
identify the inline namespaces as a namespace name since multiple ones may be
concatenated now with C++17.
llvm-svn: 251690
|
|
|
|
|
|
| |
is import-statement-like and shouldn't be wrapped.
llvm-svn: 251643
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
their indent is off.
Summary: This is especially important so that if a change is solely inserting a block around a few statements, clang-format-diff.py will still clean up and add indentation to the inner parts.
Reviewers: klimek
Subscribers: cfe-commits, klimek
Differential Revision: http://reviews.llvm.org/D14105
llvm-svn: 251474
|
|
|
|
|
|
|
|
| |
Specifically, don't wrap between the {} of an empty constructor if the
"}" falls on column 81 and ConstructorInitializerAllOnOneLineOrOnePerLine
is set.
llvm-svn: 251406
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
If this option is set, clang-format will always insert a line wrap, e.g.
before the first parameter of a function call unless all parameters fit
on the same line. This obviates the need to make a decision on the
alignment itself.
Use this style for Google's JavaScript style and add some minor tweaks
to correctly handle nested blocks etc. with it. Don't use this option
for for/while loops.
Reviewers: klimek
Subscribers: klimek, cfe-commits
Differential Revision: http://reviews.llvm.org/D14104
llvm-svn: 251405
|
|
|
|
|
|
|
|
|
|
| |
Before (with spaces in parentheses):
void inFunction() { std::function<void( int, int )> fct; }
After:
void inFunction() { std::function<void( int, int)> fct; }
llvm-svn: 251284
|
|
|
|
|
|
|
|
|
|
| |
clang accepts both #include and #import for includes (the latter having an
implicit header guard). Let clang-format interleave both types if
--sort-includes is passed. #import is used frequently in Objective-C code.
http://reviews.llvm.org/D13853
llvm-svn: 250909
|
|
|
|
| |
llvm-svn: 250675
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If a RegExp contains a character group with a quote (/["]/), the
trailing end of it is first tokenized as a string literal, which leads
to the merging code seeing an unbalanced bracket.
This change parses regex literals from the left hand side. That
simplifies the parsing code and also allows correctly handling escapes
and character classes, hopefully correctly parsing all regex literals.
Patch by Martin Probst, thank you.
Review: http://reviews.llvm.org/D13765
llvm-svn: 250648
|
|
|
|
|
|
|
|
|
|
|
| |
Chromium follows the Android style guide for Java code, and that doesn't make
the distinction between fields and non-fields that the Google Java style guide
makes:
https://source.android.com/source/code-style.html#use-standard-java-annotations
https://google.github.io/styleguide/javaguide.html#s4.8.5-annotations
llvm-svn: 250422
|
|
|
|
|
|
|
|
|
|
| |
key in Obj-C dictionary literals
This fixes: https://llvm.org/PR22647
Patch by Kent Sutherland. Thank you.
llvm-svn: 250010
|
|
|
|
|
|
|
|
|
| |
Slashes in regular expressions do not need to be escaped and do not
terminate the regular expression even without a preceding backslash.
Patch by Martin Probst. Thank you.
llvm-svn: 250009
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes this bug: https://llvm.org/bugs/show_bug.cgi?id=24504
TokenAnnotator::spaceRequiredBetween was handling TT_ForEachMacro but
not TT_ObjCForIn, so lines that look like:
for (id nextObject in (NSArray *)myArray)
would incorrectly turn into:
for (id nextObject in(NSArray *)myArray)
Patch by Kent Sutherland, thank you.
llvm-svn: 249553
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
aligning assignments.
This was done correctly when aligning the declarations, but not when
aligning assignments.
FIXME: The code between assignments and declarations alignment is
roughly duplicated and
would benefit from factorization.
Bug 25090: https://llvm.org/bugs/show_bug.cgi?id=25090
Patch by Beren Minor. Thank you.
llvm-svn: 249552
|
|
|
|
|
|
| |
This fixes llvm.org/PR25073.
llvm-svn: 249519
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
inline A operator^(const A &lhs, const A &rhs) {} int i;
After:
inline A operator^(const A &lhs, const A &rhs) {}
int i;
llvm-svn: 249517
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
void f(Type(¶meter)[10]) {}
void f(Type (*parameter)[10]) {}
After:
void f(Type (¶meter)[10]) {}
void f(Type (*parameter)[10]) {}
llvm-svn: 249502
|
|
|
|
|
|
|
|
|
|
| |
Before:
return options != nullptr &&operator==(*options);
After:
return options != nullptr && operator==(*options);
llvm-svn: 249501
|
|
|
|
|
|
|
|
|
| |
This was made much easier by introducing an IncludeCategory struct to
replace the previously used std::pair.
Also, cleaned up documentation and added examples.
llvm-svn: 249392
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This allows clang-format to align identifiers in consecutive
declarations. This is useful for increasing the readability of the code
in the same way the alignment of assignations is.
The code is a slightly modified version of the consecutive assignment
alignment code. Currently only the identifiers are aligned, and there is
no support of alignment of the pointer star or reference symbol.
The patch also solve the issue of alignments not being possible due to
the ColumnLimit for both the existing AlignConsecutiveAligments and the
new AlignConsecutiveDeclarations.
Patch by Beren Minor, thank you.
Review: http://reviews.llvm.org/D12362
llvm-svn: 248999
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
control the individual braces. The existing choices for brace wrapping
are now merely presets for the different flags that get expanded upon
calling the reformat function.
All presets have been chose to keep the existing formatting, so there
shouldn't be any difference in formatting behavior.
Also change the dump_format_style.py to properly document the nested
structs that are used to keep these flags discoverable among all the
configuration flags.
llvm-svn: 248802
|
|
|
|
|
|
|
|
|
| |
Recognize the main module header as well as different #include categories.
This should now mimic the behavior of llvm/utils/sort_includes.py as
well as clang-tools-extra/clang-tidy/llvm/IncludeOrderCheck.cpp very
closely.
llvm-svn: 248782
|
|
|
|
|
|
|
|
|
| |
JavaScript allows keywords to appear in IdenfierName positions, e.g.
fields, or object literal members, but not as plain identifiers.
Patch by Martin Probst. Thank you!
llvm-svn: 248714
|
|
|
|
|
|
| |
Patch by Martin Probst. Thank you!
llvm-svn: 248713
|
|
|
|
|
|
|
|
|
| |
To implement this nicely, add a function that merges two sets of
replacements that are meant to be done in sequence. This functionality
will also be useful for other applications, e.g. formatting the result
of clang-tidy fixes.
llvm-svn: 248367
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It wasn't correctly handling this case:
int oneTwoThree = 123;
int oneTwo = 12;
method();
Review: http://reviews.llvm.org/D12369
Patch by Beren Minor. Thank you!
llvm-svn: 248254
|
|
|
|
|
|
|
|
| |
This fixes llvm.org/PR24877.
Patch by Benjamin Daly, thank you!
llvm-svn: 248145
|
|
|
|
| |
llvm-svn: 247752
|
|
|
|
|
|
| |
Before: assert a&& b;
Now: assert a && b;
llvm-svn: 247750
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
Constructor() : initializer(0) {}
template <typename T>
Constructor()
: initializer(0) {}
After:
Constructor() : initializer(0) {}
template <typename T>
Constructor() : initializer(0) {}
llvm-svn: 246146
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
SomeType MemberFunction(const Deleted &)&;
After:
SomeType MemberFunction(const Deleted &) &;
Seems to be much more common.
llvm-svn: 245934
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
DEPRECATED("Use NewClass::NewFunction instead.") int OldFunction(
const string ¶meter) {}
Could not be formatted at all, as clang-format would both require and
disallow the break before "int".
llvm-svn: 245846
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
more consistent.
Before:
SomeType MemberFunction(const Deleted &)&&;
SomeType MemberFunction(const Deleted &) && { ... }
After:
SomeType MemberFunction(const Deleted &)&&;
SomeType MemberFunction(const Deleted &)&& { ... }
llvm-svn: 245843
|