#
eafe98f9 |
| 14-Feb-2024 |
Owen Pan <owenpiano@gmail.com> |
[clang-format] Always add a space after #if and #elif (#81578)
Fixes #81569.
|
#
4af24d4a |
| 13-Feb-2024 |
Owen Pan <owenpiano@gmail.com> |
[clang-format] Don't remove parentheses in macro definitions (#81444)
Closes #81399.
|
#
7664ddf8 |
| 10-Feb-2024 |
Owen Pan <owenpiano@gmail.com> |
[clang-format][NFC] Drop "Always" in "AlwaysBreakTemplateDeclarations"
|
#
d0337990 |
| 08-Feb-2024 |
Owen Pan <owenpiano@gmail.com> |
[clang-format] Add Leave to AlwaysBreakTemplateDeclarations (#80569)
Closes #78067.
|
Revision tags: llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1 |
|
#
617602d4 |
| 29-Jan-2024 |
sstwcw <su3e8a96kzlver@posteo.net> |
[clang-format] Handle generic selections inside parentheses (#79785)
new
```C while (_Generic(x, // long: x)(x) > x) { } while (_Generic(x, // long: x)(x)) { } ```
old
```C
[clang-format] Handle generic selections inside parentheses (#79785)
new
```C while (_Generic(x, // long: x)(x) > x) { } while (_Generic(x, // long: x)(x)) { } ```
old
```C while (_Generic(x, // long: x)(x) > x) { } while (_Generic(x, // long: x)(x)) { } ```
In the first case above, the second line previously aligned to the open parenthesis. The 4 spaces did not get added by the fallback line near the end of getNewLineColumn because there was already some indentaton. Now the spaces get added explicitly.
In the second case above, without the fake parentheses, the second line did not respect the outer parentheses, because the LastSpace field did not get set without the fake parentheses. Now the indentation of the outer level is used instead.
show more ...
|
#
25620073 |
| 04-Feb-2024 |
rmarker <37921131+rmarker@users.noreply.github.com> |
[clang-format] Add Automatic and ExceptShortType options for AlwaysBreakAfterReturnType. (#78011)
The RTBS_None option in Clang-format avoids breaking after a short
return type.
However, there was
[clang-format] Add Automatic and ExceptShortType options for AlwaysBreakAfterReturnType. (#78011)
The RTBS_None option in Clang-format avoids breaking after a short
return type.
However, there was an issue with the behaviour in that it wouldn't take
the leading indentation of the line into account.
This meant that the behaviour wasn't applying when intended.
In order to address this situation without breaking the existing
formatting, RTBS_None has been deprecated.
In its place are two new options for AlwaysBreakAfterReturnType.
The option RTBS_Automatic will break after the return type based on
PenaltyReturnTypeOnItsOwnLine.
The option RTBS_ExceptShortType will take the leading indentation into
account and prevent breaking after short return types.
This allows the inconsistent behaviour of RTBS_None to be avoided and
users to decide whether they want to allow breaking after short return
types or not.
Resolves #78010
show more ...
|
#
908fd09a |
| 01-Feb-2024 |
Owen Pan <owenpiano@gmail.com> |
[clang-format] Simplify the AfterPlacementOperator option (#79796)
Change AfterPlacementOperator to a boolean and deprecate SBPO_Never,
which meant never inserting a space except when after new/del
[clang-format] Simplify the AfterPlacementOperator option (#79796)
Change AfterPlacementOperator to a boolean and deprecate SBPO_Never,
which meant never inserting a space except when after new/delete.
Fixes #78892.
show more ...
|
Revision tags: llvmorg-19-init |
|
#
4ef646ea |
| 23-Jan-2024 |
Gedare Bloom <gedare@rtems.org> |
[clang-format]: Fix formatting of if statements with BlockIndent (#77699)
A bug with BlockIndent prevents line breaks within if (and else if)
clauses.
While fixing this bug, it appears that Ali
[clang-format]: Fix formatting of if statements with BlockIndent (#77699)
A bug with BlockIndent prevents line breaks within if (and else if)
clauses.
While fixing this bug, it appears that AlignAfterOpenBracket is not
designed to work with loop and if statements, but AlwaysBreak works on
if clauses. The documentation and tests are not clear on whether or not
this behavior is intended.
This PR preserves the `AlwaysBreak` behavior on `if` clauses without
supporting `BlockIndent` on `if` clauses to avoid regressions while
fixing the bug.
It may be reasonable to create an explicit option for alignment of if
(and loop) clauses intentionally for both `AlwaysBreak` and
`BlockIndent`
Fixes #54663.
Migrated from Differential Revision: https://reviews.llvm.org/D154755
See more discussion there. Addressed last open comment from the rev
about refactoring the complex conditional logic involved with the
`AlignAfterOpenBracket` line break behavior.
show more ...
|
#
3b171cb9 |
| 23-Jan-2024 |
Owen Pan <owenpiano@gmail.com> |
[clang-format] Fix a bug in ContinuationIndenter (#78921)
Fixes #76991.
|
#
fa6025e2 |
| 22-Jan-2024 |
Emilia Kond <emilia@rymiel.space> |
[clang-format] Don't confuse initializer equal signs in for loops (#77712)
clang-format has logic to align declarations of multiple variables of
the same type, aligning them at the equals sign. Thi
[clang-format] Don't confuse initializer equal signs in for loops (#77712)
clang-format has logic to align declarations of multiple variables of
the same type, aligning them at the equals sign. This logic is applied
in for loops as well. However, this alignment logic also erroneously
affected the equals signs of designated initializers.
This patch forbids alignment if the token 2 tokens back from the equals
sign is a designated initializer period.
Fixes https://github.com/llvm/llvm-project/issues/73902
show more ...
|
#
a464e051 |
| 20-Jan-2024 |
XDeme <66138117+XDeme@users.noreply.github.com> |
[clang-format] Handle templated elaborated type specifier in function… (#77013)
… return type.
The behavior now is consistent with the non template version.
Enabled and updated old test.
|
#
2fc2ee13 |
| 20-Jan-2024 |
XDeme <66138117+XDeme@users.noreply.github.com> |
[clang-format] Fix poor spacing in `AlignArrayOfStructures: Left` (#77868)
Fixes llvm/llvm-project#62904
`AlignArrayOfStructures: Left` combined with `SpacesInParentheses: true`
causes the first
[clang-format] Fix poor spacing in `AlignArrayOfStructures: Left` (#77868)
Fixes llvm/llvm-project#62904
`AlignArrayOfStructures: Left` combined with `SpacesInParentheses: true`
causes the first cell of every row to have 1 additional space.
We were only setting the first cell of the first row to be against the
left brace, now every row will be against the left brace.
show more ...
|
#
a7d7da6e |
| 20-Jan-2024 |
Owen Pan <owenpiano@gmail.com> |
[clang-format] Add SkipMacroDefinitionBody option (#78682)
Closes #67991.
See also: #70338
Co-authored-by: @tomekpaszek
|
#
5723fce0 |
| 15-Jan-2024 |
Ilya Biryukov <ibiryukov@google.com> |
[Format] Fix isStartOfName to recognize attributes (#76804)
This addresses a problem with formatting attributes. Some context:
- eaff083035c8 changed `isStartOfName` to fix problems inside
`#pragm
[Format] Fix isStartOfName to recognize attributes (#76804)
This addresses a problem with formatting attributes. Some context:
- eaff083035c8 changed `isStartOfName` to fix problems inside
`#pragma`s, but this behavior changed formatting of attribute macros in
an undesirable way.
- efeb546865c233dfa7706ee0316c676de9f69897 changed Google format style
to fix some widely used attributes.
Instead of changing the format style, this commit specializes behavior
introduced in eaff083035c8 to `#pragma`s. This seems to work well in
both cases.
Also update the test with two `GUARDED_BY` directives. While the
formatting after efeb546865c233dfa7706ee0316c676de9f69897 seems better,
this case is rare enough to not warrant the extra complexity. We are
reverting it back to the state it had before
efeb546865c233dfa7706ee0316c676de9f69897.
---------
Co-authored-by: Owen Pan <owenpiano@gmail.com>
show more ...
|
#
60a9874f |
| 14-Jan-2024 |
rmarker <37921131+rmarker@users.noreply.github.com> |
[clang-format] Add PenaltyBreakScopeResolution option. (#78015)
Resolves #78014
|
#
97a9dbb6 |
| 12-Jan-2024 |
XDeme <66138117+XDeme@users.noreply.github.com> |
[clang-format] Handle possible crash in `getCells` (#77723)
Done as requested in llvm/llvm-project#77045
I have changed the test a bit, because since the root problem was fixed,
the original tes
[clang-format] Handle possible crash in `getCells` (#77723)
Done as requested in llvm/llvm-project#77045
I have changed the test a bit, because since the root problem was fixed,
the original test would possibly never crash.
show more ...
|
#
093e6bdd |
| 11-Jan-2024 |
XDeme <66138117+XDeme@users.noreply.github.com> |
[clang-format] Fix crash involving array designators (#77045)
Fixes llvm/llvm-project#76716
Fixes parsing of `[0]{}`. Before this patch it was begin parsed as a
lambda, now it is correctly parsed
[clang-format] Fix crash involving array designators (#77045)
Fixes llvm/llvm-project#76716
Fixes parsing of `[0]{}`. Before this patch it was begin parsed as a
lambda, now it is correctly parsed as a designator initializer.
show more ...
|
#
b2c0c6f3 |
| 11-Jan-2024 |
Gedare Bloom <gedare@rtems.org> |
[clang-format]: Split alignment of declarations around assignment (#69340)
Function pointers are detected as a type of declaration using
FunctionTypeLParen. They are aligned based on rules for
Ali
[clang-format]: Split alignment of declarations around assignment (#69340)
Function pointers are detected as a type of declaration using
FunctionTypeLParen. They are aligned based on rules for
AlignConsecutiveDeclarations. When a function pointer is on the
right-hand side of an assignment, the alignment of the function pointer
can result in excessive whitespace padding due to the ordering of
alignment, as the alignment processes a line from left-to-right and
first aligns the declarations before and after the assignment operator,
and then aligns the assignment operator. Injection of whitespace by
alignment of declarations after the equal sign followed by alignment of
the equal sign results in the excessive whitespace.
Fixes #68079.
show more ...
|
#
cc77e332 |
| 11-Jan-2024 |
James Grant <42079499+jamesg-nz@users.noreply.github.com> |
[clang-format] Don't apply severe penalty if no possible column formats (#76675)
If there are possible column formats, but they weren't selected because
they don't fit within remaining characters f
[clang-format] Don't apply severe penalty if no possible column formats (#76675)
If there are possible column formats, but they weren't selected because
they don't fit within remaining characters for the current path then
applying severe penalty to induce column layout by selection of a
different path seems fair.
But if due to style configuration or what the input code is, there are
no possible column formats, different paths aren't going to have column
layouts. Seems wrong to apply the severe penalty to induce column
layouts if there are none available.
It just causes selection of sub-optimal paths, e.g. get bad formatting
when brace initializers are used inside lambda bodies.
Fixes #56350
show more ...
|
#
27f54796 |
| 08-Jan-2024 |
kadir çetinkaya <kadircet@google.com> |
[clang-format] Break after string literals with trailing line breaks (#76795)
This restores a subset of functionality that was forego in
d68826dfbd987377ef6771d40c1d984f09ee3b9e.
Streaming multi
[clang-format] Break after string literals with trailing line breaks (#76795)
This restores a subset of functionality that was forego in
d68826dfbd987377ef6771d40c1d984f09ee3b9e.
Streaming multiple string literals is rare enough in practice, hence
that change makes sense in general. But it seems people were
incidentally relying on this for having line breaks after string
literals that ended with `\n`.
This patch tries to restore that behavior to prevent regressions in the
upcoming LLVM release, until we can implement some configuration based
approach as proposed in https://github.com/llvm/llvm-project/pull/69859.
show more ...
|
#
41ef6fc5 |
| 29-Dec-2023 |
XDeme <66138117+XDeme@users.noreply.github.com> |
[clang-format] Fix bad indentation with attribute and templated type (#76336)
Fixes llvm/llvm-project#76314
|
#
8097a5d3 |
| 23-Dec-2023 |
XDeme <66138117+XDeme@users.noreply.github.com> |
[clang-format] Fix operator overload inconsistency in `BreakAfterAttributes: Always` (#74943)
Fixes llvm/llvm-project#74901
|
#
efeb5468 |
| 22-Dec-2023 |
Ilya Biryukov <ibiryukov@google.com> |
[clang-format] Add common attribute macros to Google style (#76239)
We have found that 199fc973ced20016b04ba540cf63a1d4914fa513 regresses
formatting of our codebases because we do not properly conf
[clang-format] Add common attribute macros to Google style (#76239)
We have found that 199fc973ced20016b04ba540cf63a1d4914fa513 regresses
formatting of our codebases because we do not properly configure the
names of attribute macros.
`GUARDED_BY` and `ABSL_GUARDED_BY` are very commoon in Google codebases
so it is reasonable to include them by default to avoid the need for
extra configuration in every Google repository.
show more ...
|
#
401f0396 |
| 17-Dec-2023 |
Owen Pan <owenpiano@gmail.com> |
[clang-format] Fix a bug in `IndentExternBlock: NoIndent` (#75731)
Fixes #36620.
Fixes #75719.
|
#
e1a4b003 |
| 07-Dec-2023 |
Owen Pan <owenpiano@gmail.com> |
[clang-format] Handle merging functions containing only a block comment (#74651)
Fixed #41854.
|