Revision tags: llvmorg-21-init |
|
#
106c483a |
| 18-Jan-2025 |
Sirraide <aeternalmail@gmail.com> |
[clang-format] Improve brace wrapping and add an option to control indentation of `export { ... }` (#110381)
`export { ... }` blocks can get a bit long, so I thought it would make sense to have an o
[clang-format] Improve brace wrapping and add an option to control indentation of `export { ... }` (#110381)
`export { ... }` blocks can get a bit long, so I thought it would make sense to have an option that makes it so their contents are not indented (basically the same argument as for namespaces).
This is based on the `NamespaceIndentation` option, except that there is no option to control the behaviour of `export` blocks when nested because nesting them doesn’t really make sense.
Additionally, brace wrapping of short `export { ... }` blocks is now controlled by the `AllowShortBlocksOnASingleLine` option. There is no separate option just for `export` blocks because you can just write e.g. `export int x;` instead of `export { int x; }`.
This closes #121723.
show more ...
|
Revision tags: llvmorg-19.1.7 |
|
#
2ea34cdf |
| 10-Jan-2025 |
Owen Pan <owenpiano@gmail.com> |
[clang-format] Stop fixing indentation on namespace closing brace (#122234)
Fixes #119790.
|
#
00934505 |
| 05-Jan-2025 |
Owen Pan <owenpiano@gmail.com> |
[clang-format] Add `TT_CompoundRequirementLBrace` for better annotation (#121539)
Also, add `ST_CompoundRequirement` to help annotating */&/&& in compound
requirement expressions as `TT_BinaryOpera
[clang-format] Add `TT_CompoundRequirementLBrace` for better annotation (#121539)
Also, add `ST_CompoundRequirement` to help annotating */&/&& in compound
requirement expressions as `TT_BinaryOperator`.
Fixes #121471.
show more ...
|
#
04610b90 |
| 05-Jan-2025 |
Owen Pan <owenpiano@gmail.com> |
[clang-format][NFC] Replace SmallVectorImpl with ArrayRef (#121621)
|
#
1c997fef |
| 03-Jan-2025 |
dmasloff <74042473+dmasloff@users.noreply.github.com> |
[clang-format] Add option WrapNamespaceBodyWithNewlines (#106145)
It wraps the body of namespace with additional newlines, turning this code:
```
namespace N {
int function();
}
```
into the f
[clang-format] Add option WrapNamespaceBodyWithNewlines (#106145)
It wraps the body of namespace with additional newlines, turning this code:
```
namespace N {
int function();
}
```
into the following:
```
namespace N {
int function();
}
```
---------
Co-authored-by: Owen Pan <owenpiano@gmail.com>
show more ...
|
#
486ec4bd |
| 30-Dec-2024 |
Galen Elias <gelias@gmail.com> |
[clang-format] Add `AllowShortNamespacesOnASingleLine` option (#105597)
This fixes #101363 which is a resurrection of a previously opened but
never completed review: https://reviews.llvm.org/D11851
[clang-format] Add `AllowShortNamespacesOnASingleLine` option (#105597)
This fixes #101363 which is a resurrection of a previously opened but
never completed review: https://reviews.llvm.org/D11851
The feature is to allow code like the following not to be broken across
multiple lines:
```
namespace foo { class bar; }
namespace foo { namespace bar { class baz; } }
```
Code like this is commonly used for forward declarations, which are
ideally kept compact. This is also apparently the format that
include-what-you-use will insert for forward declarations.
Also, fix an off-by-one error in `CompactNamespaces` code. For nested
namespaces with 3 or more namespaces, it was incorrectly compacting
lines which were 1 or two spaces over the `ColumnLimit`, leading to
incorrect formatting results.
show more ...
|
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 |
|
#
2853a838 |
| 30-Jun-2024 |
sstwcw <su3e8a96kzlver@posteo.net> |
[clang-format] Add option to remove leading blank lines (#91221)
The options regarding which blank lines are kept are also aggregated. The new option is `KeepEmptyLines`.
This patch was initially p
[clang-format] Add option to remove leading blank lines (#91221)
The options regarding which blank lines are kept are also aggregated. The new option is `KeepEmptyLines`.
This patch was initially part of 9267f8f19a2e502e. I neglected to check the server builds before I added it. It broke clangd. Jie Fu fixed the problem in 4c91b49bab0728d4. I was unaware of it. I thought the main branch was still broken. I reverted the first patch in 70cfece24d6cbb57. It broke his fix. He reverted it in c69ea04fb9738db2. Now the feature is added again including the fix.
show more ...
|
#
70cfece2 |
| 25-Jun-2024 |
sstwcw <su3e8a96kzlver@posteo.net> |
Revert "[clang-format] Add option to remove leading blank lines (#91221)"
This reverts commit 9267f8f19a2e502ef5a216c0d52b352b3699d399.
I changed a formatter option. I forgot to update other compo
Revert "[clang-format] Add option to remove leading blank lines (#91221)"
This reverts commit 9267f8f19a2e502ef5a216c0d52b352b3699d399.
I changed a formatter option. I forgot to update other components that depend on the formatter when the option name changed.
show more ...
|
Revision tags: llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6 |
|
#
9267f8f1 |
| 06-May-2024 |
sstwcw <su3e8a96kzlver@posteo.net> |
[clang-format] Add option to remove leading blank lines (#91221)
The options regarding which blank lines are kept are also aggregated. The new option is `KeepEmptyLines`.
|
#
a106131a |
| 16-Jun-2024 |
Owen Pan <owenpiano@gmail.com> |
[clang-format] Handle AttributeMacro before access modifiers (#95634)
Closes #95094.
|
#
236b3e1a |
| 07-May-2024 |
Owen Pan <owenpiano@gmail.com> |
[clang-format] Handle Java switch expressions (#91112)
Also adds AllowShortCaseExpressionOnASingleLine option and
AlignCaseArrows suboption of AlignConsecutiveShortCaseStatements.
Fixes #55903.
|
Revision tags: llvmorg-18.1.5, llvmorg-18.1.4 |
|
#
51f16814 |
| 11-Apr-2024 |
Owen Pan <owenpiano@gmail.com> |
[clang-format] Don't merge a short block for SBS_Never (#88238)
Also fix unit tests.
Fixes #87484.
|
Revision tags: llvmorg-18.1.3 |
|
#
b2082a98 |
| 20-Mar-2024 |
Owen Pan <owenpiano@gmail.com> |
Revert "[clang-format][NFC] Delete 100+ redundant #include lines in .cpp files"
This reverts commit b92d6dd704d789240685a336ad8b25a9f381b4cc. See github.com/llvm/llvm-project/commit/b92d6dd704d7#com
Revert "[clang-format][NFC] Delete 100+ redundant #include lines in .cpp files"
This reverts commit b92d6dd704d789240685a336ad8b25a9f381b4cc. See github.com/llvm/llvm-project/commit/b92d6dd704d7#commitcomment-139992444
We should use a tool like Visual Studio to clean up the headers.
show more ...
|
Revision tags: llvmorg-18.1.2 |
|
#
b92d6dd7 |
| 17-Mar-2024 |
Owen Pan <owenpiano@gmail.com> |
[clang-format][NFC] Delete 100+ redundant #include lines in .cpp files
|
Revision tags: llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4 |
|
#
b0d2a52c |
| 24-Feb-2024 |
Owen Pan <owenpiano@gmail.com> |
[clang-format][NFC] Enable RemoveSemicolon for clang-format style (#82735)
Also insert separators for decimal integers longer than 4 digits.
|
Revision tags: llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init |
|
#
e3acfbc4 |
| 15-Jan-2024 |
sstwcw <su3e8a96kzlver@posteo.net> |
[clang-format] Stop aligning the to continuation lines (#76378)
Some unwrapped lines are marked as continuations of the previous lines,
for example the ports in a Verilog module header. Previously,
[clang-format] Stop aligning the to continuation lines (#76378)
Some unwrapped lines are marked as continuations of the previous lines,
for example the ports in a Verilog module header. Previously, if the
first line following the ports line was changed, and git-clang-format
was run, the changed line would be indented by an extra continuation
indentation.
show more ...
|
#
b7770bef |
| 11-Jan-2024 |
r4nt <klimek@google.com> |
[ClangFormat] Fix formatting bugs. (#76245)
1. There are multiple calls to addFakeParenthesis; move the guard to not
assign fake parenthesis into the function to make sure we cover all
calls
[ClangFormat] Fix formatting bugs. (#76245)
1. There are multiple calls to addFakeParenthesis; move the guard to not
assign fake parenthesis into the function to make sure we cover all
calls.
2. MustBreakBefore can be set on a token in two cases: either during
unwrapped line parsing, or later, during token annotation. We must
keep the latter, but reset the former.
3. Added a test to document that the intended behavior of preferring not
to break between a return type and a function identifier.
For example, with MOCK_METHOD(r, n, a)=r n a, the code
MOCK_METHOD(void, f, (int a, int b)) should prefer the same breaks as
the expanded void f(int a, int b).
show more ...
|
#
e1a4b003 |
| 07-Dec-2023 |
Owen Pan <owenpiano@gmail.com> |
[clang-format] Handle merging functions containing only a block comment (#74651)
Fixed #41854.
|
#
1241b5b0 |
| 06-Dec-2023 |
Owen Pan <owenpiano@gmail.com> |
[clang-format][NFC] Refactor getting first/last non-comment of line (#74570)
|
#
bbae59ae |
| 29-Nov-2023 |
Owen Pan <owenpiano@gmail.com> |
[clang-format] Finalize children after formatting them (#73753)
This would also fix the overlapping replacements below:
```
$ clang-format
a(
#else
#endif
) = []() {
)}
The new repl
[clang-format] Finalize children after formatting them (#73753)
This would also fix the overlapping replacements below:
```
$ clang-format
a(
#else
#endif
) = []() {
)}
The new replacement overlaps with an existing replacement.
New replacement: <stdin>: 38:+7:"
"
Existing replacement: <stdin>: 38:+7:" "
```
Fixed #73487.
show more ...
|
Revision tags: llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4 |
|
#
69209e30 |
| 25-Oct-2023 |
Backl1ght <backlight.zzk@gmail.com> |
[clang-format] AllowShortCompoundRequirementOnASingleLine
clang-format brace wrapping did not take requires into consideration, compound requirements will be affected by BraceWrapping.AfterFunction.
[clang-format] AllowShortCompoundRequirementOnASingleLine
clang-format brace wrapping did not take requires into consideration, compound requirements will be affected by BraceWrapping.AfterFunction.
Closes #59412.
Differential Revision: https://reviews.llvm.org/D139834
show more ...
|
Revision tags: llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0 |
|
#
f465a482 |
| 05-Sep-2023 |
Arkadiy Yudintsev <udincev@yandex.ru> |
[clang-format] Fix segmentation fault when formatting nested namespaces
Fixing the clang-format crash with the segmentation fault error when formatting code with nested namespaces.
Fixes #64701.
D
[clang-format] Fix segmentation fault when formatting nested namespaces
Fixing the clang-format crash with the segmentation fault error when formatting code with nested namespaces.
Fixes #64701.
Differential Revision: https://reviews.llvm.org/D158363
show more ...
|
Revision tags: llvmorg-17.0.0-rc4 |
|
#
91c4db00 |
| 24-Aug-2023 |
Owen Pan <owenpiano@gmail.com> |
[clang-format][NFC] Replace !is() with isNot()
Differential Revision: https://reviews.llvm.org/D158571
|
Revision tags: llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init |
|
#
0570cc56 |
| 18-Jul-2023 |
Sedenion <39583823+Sedeniono@users.noreply.github.com> |
[clang-format] Fix indent for selective formatting
The problem was that the LevelIndentTracker remembered the indentation level of previous deeper levels when leaving a scope. Afterwards, when it en
[clang-format] Fix indent for selective formatting
The problem was that the LevelIndentTracker remembered the indentation level of previous deeper levels when leaving a scope. Afterwards, when it entered again a deeper level, it blindly reused the previous indentation level. In case the --lines option was used such that the previous deeper level was not formatted, that previous level was whatever happened to be there in the source code. The formatter simply believed it.
This is fixed by letting the LevelIndentTracker forget the previous deeper levels when stepping out of them (=> change in LevelIndentTracker::nextLine()). Note that this used to be the case until LLVM 14.0.6, but was changed in https://reviews.llvm.org/D129064 (#56352) to fix a crash. Our commit here essentially reverts that crash fix. It was incorrect/incomplete.
Fixes #58464. Fixes #59178. Fixes #62799.
Differential Revision: https://reviews.llvm.org/D151047
show more ...
|
#
e4aa1428 |
| 18-Jul-2023 |
Sedenion <39583823+Sedeniono@users.noreply.github.com> |
[clang-format] Refactoring and asserts in LevelIndentTracker. (NFC)
adjustToUnmodifiedLine: The code does something only for non-PP-directives. This is now reflected by putting the if-check to the t
[clang-format] Refactoring and asserts in LevelIndentTracker. (NFC)
adjustToUnmodifiedLine: The code does something only for non-PP-directives. This is now reflected by putting the if-check to the top. This also ensures that the assert() there is executed only if IndentForLevel is actually accessed.
getIndent(): assert valid index into IndentForLevel.
Added explanation regarding the intention of IndentForLevel.
Differential Revision: https://reviews.llvm.org/D155094
show more ...
|