|
Revision tags: llvmorg-20.1.0, llvmorg-20.1.0-rc3, llvmorg-20.1.0-rc2, llvmorg-20.1.0-rc1, llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7, llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init, llvmorg-14.0.6, llvmorg-14.0.5, llvmorg-14.0.4, llvmorg-14.0.3 |
|
| #
be656df1 |
| 28-Apr-2022 |
Krasimir Georgiev <[email protected]> |
[clang-format] add a regression test for include sorting
This adds a regression test from the comments on https://reviews.llvm.org/D121370.
Reviewed By: MyDeveloperDay, curdeius
Differential Revis
[clang-format] add a regression test for include sorting
This adds a regression test from the comments on https://reviews.llvm.org/D121370.
Reviewed By: MyDeveloperDay, curdeius
Differential Revision: https://reviews.llvm.org/D124513
show more ...
|
| #
e8cc7490 |
| 28-Apr-2022 |
Krasimir Georgiev <[email protected]> |
Revert "[clang-format] SortIncludes should support "@import" lines in Objective-C"
This reverts commit d46fa023caa2db5a9f1e21dd038bcb626261d958. Regressed include order in some cases with trailing c
Revert "[clang-format] SortIncludes should support "@import" lines in Objective-C"
This reverts commit d46fa023caa2db5a9f1e21dd038bcb626261d958. Regressed include order in some cases with trailing comments, see the comments on https://reviews.llvm.org/D121370. Will add a regression test in a follow-up commit.
show more ...
|
| #
db57acff |
| 26-Apr-2022 |
owenca <[email protected]> |
[clang-format] Adjust editor cursor position past #include blocks
Fixes #55027.
Differential Revision: https://reviews.llvm.org/D124452
|
|
Revision tags: llvmorg-14.0.2, llvmorg-14.0.1 |
|
| #
d46fa023 |
| 11-Apr-2022 |
Konrad Kleine <[email protected]> |
[clang-format] SortIncludes should support "@import" lines in Objective-C
Fixes [[ https://github.com/llvm/llvm-project/issues/38995 | #38995 ]]
This is an attempt to modify the regular expression
[clang-format] SortIncludes should support "@import" lines in Objective-C
Fixes [[ https://github.com/llvm/llvm-project/issues/38995 | #38995 ]]
This is an attempt to modify the regular expression to identify `@import` and `import` alongside the regular `#include`. The challenging part was not to support `@` in addition to `#` but how to handle everything that comes after the `include|import` keywords. Previously everything that wasn't `"` or `<` was consumed. But as you can see in this example from the issue #38995, there is no `"` or `<` following the keyword:
``` @import Foundation; ```
I experimented with a lot of fancy and useful expressions in [this online regex tool](https://regex101.com) only to find out that some things are simply not supported by the regex implementation in LLVM.
* For example the beginning `[\t\ ]*` should be replacable by the horizontal whitespace character `\h*` but this will break the `SortIncludesTest.LeadingWhitespace` test.
That's why I've chosen to come back to the basic building blocks.
The essential change in this patch is the change from this regular expression:
``` ^[\t\ ]*#[\t\ ]*(import|include)[^"<]*(["<][^">]*[">]) ~ ~~~~~~~~~~~~~~ ^ ^ | | only support # prefix not @ | only support "" and <> as delimiters no support for C++ modules and ; ending. Also this allows for "> or <" or "" or <> which all seems either off or wrong. ```
to this:
``` ^[\t\ ]*[@#][\t\ ]*(import|include)([^"]*("[^"]+")|[^<]*(<[^>]+>)|[\t\ ]*([^;]+;)) ~~~~ ~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~ ^ ^ ^ ^ ^ | | | | | Now support @ and #. Clearly support "" and <> as well as an include name without enclosing characters. Allows for no mixture of "> or <" or empty include names.
```
Here is how I've tested this patch:
``` ninja clang-Format ninja FormatTests ./tools/clang/unittests/Format/FormatTests --gtest_filter=SortIncludesTest* ```
And if that worked I doubled checked that nothing else broke by running all format checks:
``` ./tools/clang/unittests/Format/FormatTests ```
One side effect of this change is it should partially support [C++20 Module](https://en.cppreference.com/w/cpp/language/modules) `import` lines without the optional `export` in front. Adding this can be a change on its own that shouldn't be too hard. I say partially because the `@` or `#` are currently *NOT* optional in the regular expression.
I see an opportunity to optimized the matching to exclude `@include` for example. But eventually these should be caught by the compiler, so...
With my change, the matching group is not at a fixed position any longer. I decided to choose the last match (group) that is not empty.
Reviewed By: HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D121370
show more ...
|
|
Revision tags: llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3, llvmorg-14.0.0-rc2, llvmorg-14.0.0-rc1, llvmorg-15-init |
|
| #
95bf0a9e |
| 31-Jan-2022 |
Marek Kurdej <[email protected]> |
[clang-format] Don't break block comments when sorting includes.
Fixes https://github.com/llvm/llvm-project/issues/34626.
Before, the include sorter would break the code: ``` #include <stdio.h> #in
[clang-format] Don't break block comments when sorting includes.
Fixes https://github.com/llvm/llvm-project/issues/34626.
Before, the include sorter would break the code: ``` #include <stdio.h> #include <stdint.h> /* long comment */ ``` and change it into: ``` #include <stdint.h> /* long #include <stdio.h> comment */ ```
This commit handles only the most basic case of a single block comment on an include line, but does not try to handle all the possible edge cases with multiple comments.
Reviewed By: HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D118627
show more ...
|
|
Revision tags: llvmorg-13.0.1, llvmorg-13.0.1-rc3, llvmorg-13.0.1-rc2 |
|
| #
05bea533 |
| 12-Dec-2021 |
mydeveloperday <[email protected]> |
[clang-format] [PR49298] Sort includes pass will sort inside raw strings
https://github.com/llvm/llvm-project/issues/48642
clang-format does not respect raw string literals when sorting includes
`
[clang-format] [PR49298] Sort includes pass will sort inside raw strings
https://github.com/llvm/llvm-project/issues/48642
clang-format does not respect raw string literals when sorting includes
``` const char *RawStr = R"( )"; ```
Running clang-format over with SortIncludes enabled transforms this code to:
``` const char *RawStr = R"( )"; ``` The following code tries to minimize this impact during IncludeSorting, by treating R"( and )" as equivalent of // clang-format off/on
Reviewed By: HazardyKnusperkeks, curdeius
Differential Revision: https://reviews.llvm.org/D115168
Fixes #48642
show more ...
|
|
Revision tags: llvmorg-13.0.1-rc1, llvmorg-13.0.0, llvmorg-13.0.0-rc4, llvmorg-13.0.0-rc3, llvmorg-13.0.0-rc2, llvmorg-13.0.0-rc1, llvmorg-14-init, llvmorg-12.0.1, llvmorg-12.0.1-rc4, llvmorg-12.0.1-rc3, llvmorg-12.0.1-rc2, llvmorg-12.0.1-rc1 |
|
| #
61dc0f2b |
| 04-May-2021 |
Nathan James <[email protected]> |
[Format] Don't sort includes if DisableFormat is true
Fixes https://llvm.org/PR35099.
I'm not sure if this decision was intentional but its definitely confusing for users.
Reviewed By: MyDeveloper
[Format] Don't sort includes if DisableFormat is true
Fixes https://llvm.org/PR35099.
I'm not sure if this decision was intentional but its definitely confusing for users.
Reviewed By: MyDeveloperDay, HazardyKnusperkeks, curdeius
Differential Revision: https://reviews.llvm.org/D101628
show more ...
|
|
Revision tags: llvmorg-12.0.0, llvmorg-12.0.0-rc5, llvmorg-12.0.0-rc4, llvmorg-12.0.0-rc3 |
|
| #
7b02794f |
| 04-Mar-2021 |
Björn Schäpers <[email protected]> |
[clang-format] Rename case sorting
As discussed in D95017 the names case sensitive and insensitive should be switched.
This amends a8105b3766e4.
Differential Revision: https://reviews.llvm.org/D97
[clang-format] Rename case sorting
As discussed in D95017 the names case sensitive and insensitive should be switched.
This amends a8105b3766e4.
Differential Revision: https://reviews.llvm.org/D97927
show more ...
|
|
Revision tags: llvmorg-12.0.0-rc2, llvmorg-11.1.0, llvmorg-11.1.0-rc3 |
|
| #
a8105b37 |
| 02-Feb-2021 |
Kent Sommer <[email protected]> |
[clang-format] Add case aware include sorting.
Adds an option to [clang-format] which sorts headers in an alphabetical manner using case only for tie-breakers. The options is off by default in favor
[clang-format] Add case aware include sorting.
Adds an option to [clang-format] which sorts headers in an alphabetical manner using case only for tie-breakers. The options is off by default in favor of the current ASCIIbetical sorting style.
Reviewed By: MyDeveloperDay, curdeius, HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D95017
show more ...
|
|
Revision tags: llvmorg-12.0.0-rc1, llvmorg-13-init |
|
| #
6d5c1cd2 |
| 26-Jan-2021 |
Marek Kurdej <[email protected]> |
Revert "[clang-format] add case aware include sorting"
This reverts commit 3395a336b02538d0bb768ccfae11c9b6151b102e as there was a post-merge doubt about option naming and type.
|
| #
3395a336 |
| 25-Jan-2021 |
Lukas Barth <[email protected]> |
[clang-format] add case aware include sorting
* Adds an option to [clang-format] which sorts headers in an alphabetical manner using case only for tie-breakers. The options is off by default i
[clang-format] add case aware include sorting
* Adds an option to [clang-format] which sorts headers in an alphabetical manner using case only for tie-breakers. The options is off by default in favor of the current ASCIIbetical sorting style.
Reviewed By: curdeius, HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D95017
show more ...
|
|
Revision tags: llvmorg-11.1.0-rc2, llvmorg-11.1.0-rc1 |
|
| #
89878e8c |
| 11-Jan-2021 |
Rafał Jelonek <[email protected]> |
[clang-format] Find main include after block ended with #pragma hdrstop
Find main include in first include block not ended with #pragma hdrstop
Reviewed By: curdeius
Differential Revision: https:/
[clang-format] Find main include after block ended with #pragma hdrstop
Find main include in first include block not ended with #pragma hdrstop
Reviewed By: curdeius
Differential Revision: https://reviews.llvm.org/D94217
show more ...
|
| #
7473940b |
| 11-Jan-2021 |
Rafał Jelonek <[email protected]> |
[clang-format] turn on formatting after "clang-format on" while sorting includes
Formatting is not active after "clang-format on" due to merging lines while formatting is off. Also, use trimmed line
[clang-format] turn on formatting after "clang-format on" while sorting includes
Formatting is not active after "clang-format on" due to merging lines while formatting is off. Also, use trimmed line. Behaviour with LF is different than with CRLF.
Reviewed By: curdeius, MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D94206
show more ...
|
| #
ee27c767 |
| 11-Jan-2021 |
Rafał Jelonek <[email protected]> |
[clang-format] Skip UTF8 Byte Order Mark while sorting includes
If file contain BOM then first instruction (include or clang-format off) is ignored
Reviewed By: MyDeveloperDay
Differential Revisio
[clang-format] Skip UTF8 Byte Order Mark while sorting includes
If file contain BOM then first instruction (include or clang-format off) is ignored
Reviewed By: MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D94201
show more ...
|
|
Revision tags: llvmorg-11.0.1, llvmorg-11.0.1-rc2 |
|
| #
8668eae2 |
| 05-Dec-2020 |
mydeveloperday <[email protected]> |
[clang-format] Add option for case sensitive regexes for sorted includes
I think the title says everything.
Reviewed By: MyDeveloperDay
Patch By: HazardyKnusperkeks
Differential Revision: https:
[clang-format] Add option for case sensitive regexes for sorted includes
I think the title says everything.
Reviewed By: MyDeveloperDay
Patch By: HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D91507
show more ...
|
| #
fe21c86e |
| 03-Dec-2020 |
Marek Kurdej <[email protected]> |
[clang-format] De-duplicate includes with leading or trailing whitespace.
This fixes PR46555 (https://bugs.llvm.org/show_bug.cgi?id=46555).
Reviewed By: MyDeveloperDay
Differential Revision: https
[clang-format] De-duplicate includes with leading or trailing whitespace.
This fixes PR46555 (https://bugs.llvm.org/show_bug.cgi?id=46555).
Reviewed By: MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D88296
show more ...
|
|
Revision tags: llvmorg-11.0.1-rc1 |
|
| #
84048e23 |
| 20-Oct-2020 |
Haojian Wu <[email protected]> |
[format] foo.<name>.h should be the main-header for foo.<name>.cc
This fixes a regression introduced in https://reviews.llvm.org/D88640.
Differential Revision: https://reviews.llvm.org/D89783
|
|
Revision tags: llvmorg-11.0.0, llvmorg-11.0.0-rc6 |
|
| #
c1b209cc |
| 01-Oct-2020 |
Haojian Wu <[email protected]> |
[Format] Don't treat compound extension headers (foo.proto.h) as foo.cc main-file header.
We receive internal bugs about this false positives after D86597.
Differential Revision: https://reviews.ll
[Format] Don't treat compound extension headers (foo.proto.h) as foo.cc main-file header.
We receive internal bugs about this false positives after D86597.
Differential Revision: https://reviews.llvm.org/D88640.
show more ...
|
|
Revision tags: llvmorg-11.0.0-rc5, llvmorg-11.0.0-rc4, llvmorg-11.0.0-rc3, llvmorg-11.0.0-rc2, llvmorg-11.0.0-rc1, llvmorg-12-init, llvmorg-10.0.1, llvmorg-10.0.1-rc4, llvmorg-10.0.1-rc3, llvmorg-10.0.1-rc2, llvmorg-10.0.1-rc1 |
|
| #
ece7e95f |
| 02-May-2020 |
mydeveloperday <[email protected]> |
[clang-format] NFC - clang-format the FormatTests
Summary: Ensure the clang-format unit tests are themselves clang-formatted
Having areas of the llvm code which are clang-format clean, give us more
[clang-format] NFC - clang-format the FormatTests
Summary: Ensure the clang-format unit tests are themselves clang-formatted
Having areas of the llvm code which are clang-format clean, give us more areas to run new clang-format binaries on ensuring we haven't broken anything.
It seems to me we SHOULD have this clang-formatted at a minimum, otherwise how can we expect others to use clang-format if we "don't eat our own dogfood", also if the tests are dependent on the formatting of the code then that would also be bad!
Reviewed By: sammccall
Subscribers: cfe-commits
Tags: #clang, #clang-format
Differential Revision: https://reviews.llvm.org/D79204
show more ...
|
|
Revision tags: llvmorg-10.0.0, llvmorg-10.0.0-rc6, llvmorg-10.0.0-rc5, llvmorg-10.0.0-rc4, llvmorg-10.0.0-rc3, llvmorg-10.0.0-rc2, llvmorg-10.0.0-rc1, llvmorg-11-init, llvmorg-9.0.1, llvmorg-9.0.1-rc3, llvmorg-9.0.1-rc2, llvmorg-9.0.1-rc1 |
|
| #
335ac2eb |
| 12-Nov-2019 |
mydeveloperday <[email protected]> |
Allow additional file suffixes/extensions considered as source in main include grouping
Summary: By additional regex match, grouping of main include can be enabled in files that are not normally con
Allow additional file suffixes/extensions considered as source in main include grouping
Summary: By additional regex match, grouping of main include can be enabled in files that are not normally considered as a C/C++ source code. For example, this might be useful in templated code, where template implementations are being held in *Impl.hpp files. On the occassion, 'assume-filename' option description was reworded as it was misleading. It has nothing to do with `style=file` option and it does not influence sourced style filename.
Reviewers: rsmith, ioeric, krasimir, sylvestre.ledru, MyDeveloperDay
Reviewed By: MyDeveloperDay
Subscribers: MyDeveloperDay, cfe-commits
Patch by: furdyna
Tags: #clang
Differential Revision: https://reviews.llvm.org/D67750
show more ...
|
| #
60365021 |
| 01-Oct-2019 |
Paul Hoad <[email protected]> |
[clang-format] [PR43372] - clang-format shows replacements in DOS files when no replacement is needed
Summary: This is a patch to fix PR43372 (https://bugs.llvm.org/show_bug.cgi?id=43372) - clang-fo
[clang-format] [PR43372] - clang-format shows replacements in DOS files when no replacement is needed
Summary: This is a patch to fix PR43372 (https://bugs.llvm.org/show_bug.cgi?id=43372) - clang-format can't format file with includes, ( which really keep providing replacements for already sorted headers.)
A similar issue was addressed by @krasimir in {D60199}, however, this seemingly only prevented the issue when the files being formatted did not contain windows line endings (\r\n)
It's possible this is related to https://twitter.com/StephanTLavavej/status/1176722938243895296 given who @STL_MSFT works for!
As people often used the existence of replacements to determine if a file needs clang-formatting, this is probably pretty important for windows users
There may be a better way of comparing 2 strings and ignoring \r (which appear in both Results and Code), I couldn't choose between this idiom or the copy_if approach, but I'm happy to change it to whatever people consider more performant.
Reviewers: krasimir, klimek, owenpan, ioeric
Reviewed By: krasimir
Subscribers: cfe-commits, STL_MSFT, krasimir
Tags: #clang-format, #clang, #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D68227
llvm-svn: 373388
show more ...
|
| #
43fd14ca |
| 26-Sep-2019 |
Mikael Holmen <[email protected]> |
[SortIncludesTest] Add SortPriority fields to fix -Wmissing-field-initializers after D64695/r372919
llvm-svn: 372944
|
| #
52e44b14 |
| 25-Sep-2019 |
Paul Hoad <[email protected]> |
[clang-format] Modified SortIncludes and IncludeCategories to priority for sorting #includes within the Group Category.
Summary: This new Style rule is made as a part of adding support for NetBSD KN
[clang-format] Modified SortIncludes and IncludeCategories to priority for sorting #includes within the Group Category.
Summary: This new Style rule is made as a part of adding support for NetBSD KNF in clang-format. NetBSD have it's own priority of includes which should be followed while formatting NetBSD code. This style sorts the Cpp Includes according to the priorities of NetBSD, as mentioned in the [Style Guide](http://cvsweb.netbsd.org/bsdweb.cgi/src/share/misc/style?rev=HEAD&content-type=text/x-cvsweb-markup) The working of this Style rule shown below:
**Configuration:** This revision introduces a new field under IncludeCategories named `SortPriority` which defines the priority of ordering the `#includes` and the `Priority` will define the categories for grouping the `#include blocks`.
Reviewers: cfe-commits, mgorny, christos, MyDeveloperDay
Reviewed By: MyDeveloperDay
Subscribers: lebedev.ri, rdwampler, christos, mgorny, krytarowski
Patch By: Manikishan
Tags: #clang, #clang-format
Differential Revision: https://reviews.llvm.org/D64695
llvm-svn: 372919
show more ...
|
|
Revision tags: llvmorg-9.0.0, llvmorg-9.0.0-rc6, llvmorg-9.0.0-rc5, llvmorg-9.0.0-rc4, llvmorg-9.0.0-rc3, llvmorg-9.0.0-rc2, llvmorg-9.0.0-rc1, llvmorg-10-init, llvmorg-8.0.1, llvmorg-8.0.1-rc4, llvmorg-8.0.1-rc3, llvmorg-8.0.1-rc2, llvmorg-8.0.1-rc1 |
|
| #
00e7ae9f |
| 04-Apr-2019 |
Krasimir Georgiev <[email protected]> |
[clang-format] Preserve include blocks in ObjC Google style
Summary: r357567 started to regroup include block for Google style; it was meant to apply only for C++. This patch reverts this for ObjC.
[clang-format] Preserve include blocks in ObjC Google style
Summary: r357567 started to regroup include block for Google style; it was meant to apply only for C++. This patch reverts this for ObjC.
Reviewers: ioeric
Reviewed By: ioeric
Subscribers: thakis, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D60263
llvm-svn: 357695
show more ...
|
| #
925bb20c |
| 03-Apr-2019 |
Krasimir Georgiev <[email protected]> |
[clang-format] Do not emit replacements while regrouping if Cpp includes are OK
Summary: Currently clang-format would always emit a replacement for multi-block #include sections if `IBS_Regroup`, ev
[clang-format] Do not emit replacements while regrouping if Cpp includes are OK
Summary: Currently clang-format would always emit a replacement for multi-block #include sections if `IBS_Regroup`, even if the sections are correct: ``` % cat ~/test.h #include <a.h>
#include "b.h" % bin/clang-format --output-replacements-xml -style=google ~/test.h <?xml version='1.0'?> <replacements xml:space='preserve' incomplete_format='false'> <replacement offset='0' length='30'>#include <a.h> #include "b.h"</replacement> </replacements> % ```
This change makes clang-format not emit replacements in this case. The logic is similar to the one implemented for Java in r354452.
Reviewers: ioeric
Reviewed By: ioeric
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D60199
llvm-svn: 357599
show more ...
|