Revision tags: llvmorg-21-init, llvmorg-19.1.7 |
|
#
141c544c |
| 25-Dec-2024 |
Owen Pan <owenpiano@gmail.com> |
[clang-format] Skip line splices when sorting C++ includes (#120680)
Fixes #109864.
|
Revision tags: 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 |
|
#
ceade83a |
| 05-Jul-2024 |
Owen Pan <owenpiano@gmail.com> |
[clang-format] Skip block commented out includes when sorting them (#97787)
Fixes #97539.
|
Revision tags: llvmorg-18.1.8, llvmorg-18.1.7 |
|
#
1c58208d |
| 21-May-2024 |
Owen Pan <owenpiano@gmail.com> |
[clang-format][NFC] Remove redundnat llvm::, clang::, etc.
|
#
2d5e488c |
| 19-May-2024 |
Owen Pan <owenpiano@gmail.com> |
[clang-format][NFC] Clean up SortIncludesTest.cpp
Wherever applicable, replace EXPECT_EQ with verifyFormat and std::string with StringRef. Also, change a raw string literal to a regular one.
|
Revision tags: llvmorg-18.1.6, llvmorg-18.1.5 |
|
#
2de0bedf |
| 26-Apr-2024 |
NorthBlue333 <43409865+NorthBlue333@users.noreply.github.com> |
[clang-format] Do not update cursor pos if no includes replacement (#77456)
Fix https://github.com/llvm/llvm-project/issues/77450.
---------
Signed-off-by: NorthBlue333 <north333@free.fr>
Co-
[clang-format] Do not update cursor pos if no includes replacement (#77456)
Fix https://github.com/llvm/llvm-project/issues/77450.
---------
Signed-off-by: NorthBlue333 <north333@free.fr>
Co-authored-by: Owen Pan <owenpiano@gmail.com>
show more ...
|
Revision tags: 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 |
|
#
984dd15d |
| 06-Feb-2024 |
j-jorge <j-jorge@users.noreply.github.com> |
[clang-format] Add MainIncludeChar option. (#78752)
Resolves #27008, #39735, #53013, #63619.
Hello, this PR adds the MainIncludeChar option to clang-format, allowing
to select which include synt
[clang-format] Add MainIncludeChar option. (#78752)
Resolves #27008, #39735, #53013, #63619.
Hello, this PR adds the MainIncludeChar option to clang-format, allowing
to select which include syntax must be considered when searching for the
main header: quotes (`#include "foo.hpp"`, the default), brackets
(`#include <foo.hpp>`), or both.
The lack of support for brackets has been reported many times, see the
linked issues, so I am pretty sure there is a need for it :)
A short note about why I did not implement a regex approach as discussed
in #53013: while a regex would have allowed many extra ways to describe
the main header, the bug descriptions listed above suggest a very simple
need: support brackets for the main header. This PR answers this needs
in a quite simple way, with a very simple style option. IMHO the feature
space covered by the regex (again, for which there is no demand :)) can
be implemented latter, in addition to the proposed option.
The PR also includes tests for the option with and without grouped
includes.
show more ...
|
Revision tags: llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4 |
|
#
9299ace0 |
| 27-Oct-2023 |
Owen Pan <owenpiano@gmail.com> |
[clang-format][NFC] Remove extraneous newlines in remaining unit tests
|
Revision tags: 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 |
|
#
c25cc84b |
| 09-Dec-2022 |
Kazu Hirata <kazu@google.com> |
[clang] Don't including None.h (NFC)
These source files no longer use None, so they do not need to include None.h.
This is part of an effort to migrate from llvm::Optional to std::optional:
https:
[clang] Don't including None.h (NFC)
These source files no longer use None, so they do not need to include None.h.
This is part of an effort to migrate from llvm::Optional to std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
show more ...
|
Revision tags: llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, working, 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 <krasimir@google.com> |
[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 <krasimir@google.com> |
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 <owenpiano@gmail.com> |
[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 <kkleine@redhat.com> |
[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 <marek.kurdej+llvm.org@gmail.com> |
[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 <mydeveloperday@gmail.com> |
[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 <n.james93@hotmail.co.uk> |
[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 <bjoern@hazardy.de> |
[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 <work@kentsommer.com> |
[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 <marek.kurdej@gmail.com> |
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 <work@kentsommer.com> |
[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 <71409580+rjelonek@users.noreply.github.com> |
[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 <71409580+rjelonek@users.noreply.github.com> |
[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 <71409580+rjelonek@users.noreply.github.com> |
[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 <mydeveloperday@gmail.com> |
[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 <marek@quasardb.net> |
[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 <hokein.wu@gmail.com> |
[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
|