| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
We prefer setting these in our .clang-format file as the macros change over
time. (Also, the code was setting MacroBlockBegin twice and didn't set
MacroBlockEnd, so it wasn't doing what it tried to do anyways.)
llvm-svn: 248205
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Add brace style `BS_WebKit` as described on https://www.webkit.org/coding/coding-style.html:
* Function definitions: place each brace on its own line.
* Other braces: place the open brace on the line preceding the code block; place the close brace on its own line.
Set brace style used in `getWebKitStyle()` to the newly added `BS_WebKit`.
Reviewers: djasper, klimek
Subscribers: klimek, cfe-commits
Differential Revision: http://reviews.llvm.org/D11837
llvm-svn: 244446
|
|
|
|
|
|
| |
compatibility and variable alignment.
llvm-svn: 242611
|
|
|
|
|
|
| |
Differential Revision: http://reviews.llvm.org/D10883
llvm-svn: 241986
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The MacroBlockBegin and MacroBlockEnd options make matching macro identifiers
behave like '{' and '}', respectively, in terms of indentation.
Mozilla code, for example, uses several macros that begin and end a scope.
Previously, Clang-Format removed the indentation resulting in:
MACRO_BEGIN(...)
MACRO_ENTRY(...)
MACRO_ENTRY(...)
MACRO_END
Now, using the options
MacroBlockBegin: "^[A-Z_]+_BEGIN$"
MacroBlockEnd: "^[A-Z_]+_END$"
will yield the expected result:
MACRO_BEGIN(...)
MACRO_ENTRY(...)
MACRO_ENTRY(...)
MACRO_END
Differential Revision: http://reviews.llvm.org/D10840
llvm-svn: 241363
|
|
|
|
|
|
|
| |
Using the token type "unknown" can interfere badly with
WhitespaceManager's way of handling multiline comments.
llvm-svn: 241273
|
|
|
|
| |
llvm-svn: 241264
|
|
|
|
|
|
| |
The lexer wasn't properly reset leading to unexpected deletions.
llvm-svn: 241262
|
|
|
|
| |
llvm-svn: 241259
|
|
|
|
|
|
|
| |
Some counts were off, we don't need to take the leading newlines of the
first ` into account and some tests were just wrong.
llvm-svn: 241257
|
|
|
|
|
|
|
|
| |
functions only
Differential Revision: http://reviews.llvm.org/D10774
llvm-svn: 240959
|
|
|
|
|
|
|
|
| |
Summary: This makes the Mozilla style defaults more compliant with the Mozilla style guide. A few options were removed in order to use the LLVM style defaults.
Differential Revision: http://reviews.llvm.org/D10771
llvm-svn: 240957
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: Depends on D10785.
Reviewers: djasper
Reviewed By: djasper
Subscribers: klimek, cfe-commits
Differential Revision: http://reviews.llvm.org/D10786
llvm-svn: 240909
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: djasper
Reviewed By: djasper
Subscribers: klimek, cfe-commits
Differential Revision: http://reviews.llvm.org/D10784
llvm-svn: 240907
|
|
|
|
| |
llvm-svn: 240548
|
|
|
|
| |
llvm-svn: 240353
|
|
|
|
|
|
|
|
|
|
|
|
| |
The patch is generated using this command:
$ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \
-checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \
work/llvm/tools/clang
To reduce churn, not touching namespaces spanning less than 10 lines.
llvm-svn: 240270
|
|
|
|
| |
llvm-svn: 239903
|
|
|
|
|
|
|
|
|
|
| |
Before, these would not properly detected because of the char/string
literal found when re-lexing after the first `:
var x = `'`; // comment with matching quote '
var x = `"`; // comment with matching quote "
llvm-svn: 239693
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before clang-format would e.g. add a space into
#define Q_FOREACH(x, y)
which turns this into a non-function-like macro.
Patch by Strager Neds, thank you!
llvm-svn: 239513
|
|
|
|
| |
llvm-svn: 238822
|
|
|
|
|
|
|
|
|
|
|
|
| |
Assigns a token type (TT_JsFatArrow) to => tokens, and uses that to
more easily recognize and format fat arrow functions.
Improves function parsing to better recognize formal parameter
lists and return type declarations.
Recognizes arrow functions and parse function bodies as child blocks.
Patch by Martin Probst.
llvm-svn: 237895
|
|
|
|
|
|
|
|
|
|
|
|
| |
Pull various parts of the UnwrappedLineFormatter into their own
abstractions. NFC.
There are two things left for subsequent changes (to keep this
reasonably small)
- the UnwrappedLineFormatter now has a bad name
- the UnwrappedLineFormatter::format function is still too large
llvm-svn: 236974
|
|
|
|
|
|
|
| |
This prevents clang-format from inadvertently joining stuff into macro
definitions as reported in llvm.org/PR23466.
llvm-svn: 236944
|
|
|
|
|
|
|
|
|
|
| |
Before:
var regex = /= / ;
After:
var regex = /=/;
llvm-svn: 236811
|
|
|
|
|
|
| |
formatted due to syntax errors.
llvm-svn: 236722
|
|
|
|
| |
llvm-svn: 236594
|
|
|
|
|
|
| |
We were already ignoring those already.
llvm-svn: 236591
|
|
|
|
|
|
|
|
|
| |
In the process, fix an old todo that I don't really know how to write
tests for. The problem is that Clang's lexer creates very strange token
sequences for these. However, the new approach seems generally better
and easier to read so I am submitting it nonetheless.
llvm-svn: 236589
|
|
|
|
| |
llvm-svn: 236415
|
|
|
|
|
|
|
|
|
|
| |
OriginalColumn might not be set, so fall back to Location and SourceMgr
in case it is missing. Also initialize end column in case the token is
multi line, but it's the ` token itself that starts the multi line.
Patch by Martin Probst, thank you!
llvm-svn: 236383
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In Objective-C some style guides use a style where assignment operators are
aligned, in an effort to increase code readability. This patch adds an option
to the format library which allows this functionality. It is disabled by
default for all the included styles, so it must be explicitly enabled.
The option will change code such as:
- (void)method {
NSNumber *one = @1;
NSNumber *twentyFive = @25;
}
to:
- (void)method {
NSNumber *one = @1;
NSNumber *twentyFive = @25;
}
Patch by Matt Oakes. Thank you!
Accidentally reformatted all the tests...
llvm-svn: 236100
|
|
|
|
|
|
| |
Patch by Martin Probst. Thank you.
llvm-svn: 235078
|
|
|
|
| |
llvm-svn: 234055
|
|
|
|
|
|
|
| |
NewlinesBefore and HasUnescapedNewline were not properly propagated
leading to llvm.org/PR23032.
llvm-svn: 233276
|
|
|
|
|
|
| |
Patch by Martin Probst. Thank you.
llvm-svn: 231926
|
|
|
|
|
|
| |
NFC.
llvm-svn: 231597
|
|
|
|
|
|
| |
Commit of patch in http://reviews.llvm.org/D7871
llvm-svn: 230395
|
|
|
|
|
|
| |
Commit of review http://reviews.llvm.org/D7766
llvm-svn: 230061
|
|
|
|
|
|
|
|
|
| |
Merge template strings (marked by backticks ``).
Do not format any contents of template strings.
Patch by Martin Probst. Thank you.
llvm-svn: 230011
|
|
|
|
|
|
| |
Committing patch http://reviews.llvm.org/D6800.
llvm-svn: 229783
|
|
|
|
| |
llvm-svn: 228288
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This lets clang-format format
__try {
} __except(0) {
}
and
__try {
} __finally {
}
correctly. __try and __finally are keywords if `LangOpts.MicrosoftExt` is set,
so this turns this on. This also enables a few other keywords, but it
shouldn't overly perturb regular clang-format operation. __except is a
context-sensitive keyword, so `AdditionalKeywords` needs to be passed around to
a few more places.
Fixes PR22321.
llvm-svn: 228148
|
|
|
|
|
|
|
|
|
|
| |
I have so far not succeeded in finding a nicely reduced test case or an
observable difference which could help me create a test failure without
msan.
Committing without test to unblock kcc's further fuzzing progress.
llvm-svn: 227433
|