| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
| |
Before, the first (non-system) header in a file was considered to be
the main include. This is conservative as it makes clang-format change
the #include order less often. Instead implement some basic usage of
the filename itself. With this patch, clang-format considers every
header to be a main include if the header file's basename is a prefix
to the filename the #include is in.
llvm-svn: 256148
|
|
|
|
|
|
|
|
|
|
|
| |
This changes the behavior of AlwaysBreakAfterDeclarationReturnType
so that it supports breaking after declarations, definitions, or
both.
Differential Revision: http://reviews.llvm.org/D10370
Reviewed By: Daniel Jasper
llvm-svn: 256046
|
|
|
|
|
|
|
|
|
|
| |
Specifically, it is sometimes necessary to keep certain #includes as
the first #include, even before the main #include for a .cc file.
Switching the category to be signed instead of unsigned isn't ideal,
but it seems as good of an option as any and is fully backwards
compatible.
llvm-svn: 255757
|
|
|
|
|
|
|
|
| |
Brought up in codereviews:
http://reviews.llvm.org/D15445
http://reviews.llvm.org/D15485
llvm-svn: 255484
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
No functional changes intended.
llvm-svn: 253873
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
https://gcc.gnu.org/onlinedocs/gcc/Typeof.html
Differences from the GCC extension:
* __auto_type is also permitted in C++ (but only in places where
it could appear in C), allowing its use in headers that might
be shared across C and C++, or used from C++98
* __auto_type can be combined with a declarator, as with C++ auto
(for instance, "__auto_type *p")
* multiple variables can be declared in a single __auto_type
declaration, with the C++ semantics (the deduced type must be
the same in each case)
This patch also adds a missing restriction on applying typeof to
a bit-field, which GCC has historically rejected in C (due to
lack of clarity as to whether the operand should be promoted).
The same restriction also applies to __auto_type in C (in both
GCC and Clang).
This also fixes PR25449.
Patch by Nicholas Allegra!
llvm-svn: 252690
|
|
|
|
| |
llvm-svn: 252089
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
| |
With more complex structures in C++ Lambdas and JavaScript function
literals, the old value was simply to small. However, this is a
temporary solution, I need to look at this more closely a) to find a
fundamentally better approach and b) to look at whether the more recent
usage of NoLineBreak makes us visit stuff in an unfortunate order
where clang-format waste many states in dead ends.
llvm-svn: 251463
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
| |
Summary: It breaks the build for the ASTMatchers
Subscribers: klimek, cfe-commits
Differential Revision: http://reviews.llvm.org/D13893
llvm-svn: 250827
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: Replace empty bodies of default constructors and destructors with '= default'.
Reviewers: bkramer, klimek
Subscribers: klimek, alexfh, cfe-commits
Differential Revision: http://reviews.llvm.org/D13890
llvm-svn: 250822
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
| |
Apart from being cleaner this also means that clang-format no longer has
access to the host file system. This isn't necessary because clang-format
never reads includes :)
Includes minor tweaks and bugfixes found in the VFS implementation while
running clang-format tests.
llvm-svn: 249385
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In versions of clang prior to r238238, __declspec was recognized as a keyword in
all modes. It was then changed to only be enabled when Microsoft or Borland
extensions were enabled (and for CUDA, as a temporary measure). There is a
desire to support __declspec in Playstation code, and possibly other
environments. This commit adds a command-line switch to allow explicit
enabling/disabling of the recognition of __declspec as a keyword. Recognition
is enabled by default in Microsoft, Borland, CUDA, and PS4 environments, and
disabled in all other environments.
Patch by Warren Ristow!
llvm-svn: 249279
|
|
|
|
| |
llvm-svn: 249259
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|