Commit 617602d
committed
[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.1 parent 942cb24 commit 617602d
File tree
2 files changed
+14
-2
lines changed- clang
- lib/Format
- unittests/Format
2 files changed
+14
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1702 | 1702 | | |
1703 | 1703 | | |
1704 | 1704 | | |
1705 | | - | |
1706 | | - | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
| 1709 | + | |
1707 | 1710 | | |
1708 | 1711 | | |
1709 | 1712 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24147 | 24147 | | |
24148 | 24148 | | |
24149 | 24149 | | |
| 24150 | + | |
| 24151 | + | |
| 24152 | + | |
| 24153 | + | |
| 24154 | + | |
| 24155 | + | |
| 24156 | + | |
| 24157 | + | |
| 24158 | + | |
24150 | 24159 | | |
24151 | 24160 | | |
24152 | 24161 | | |
| |||
0 commit comments