| Issue |
52855
|
| Summary |
Initializer lists indented incorrectly
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
yurikhan
|
```
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.3 LTS
Release: 20.04
Codename: focal
$ clang-format-12 --version
Ubuntu clang-format version 12.0.0-3ubuntu1~20.04.4
```
.clang-format:
```yaml
IndentWidth: 4
TabWidth: 4
UseTab: ForContinuationAndIndentation
ContinuationIndentWidth: 4
```
Observed indentation:
```
int a_very_long_function_name(int);
struct Foo {
→ int a_very_long_member_name;
→ Foo();
};
Foo::Foo()
→ : a_very_long_member_name(
→ → ··a_very_long_function_name(a_very_long_function_name(42))) {}
```
Specifically, it looks like the continuation line is indented +4 relative to the name of the member being initialized (which is naturally +2 from the start of line).
Desired indentation:
```
int a_very_long_function_name(int);
struct Foo {
→ int a_very_long_member_name;
→ Foo();
};
Foo::Foo()
→ : a_very_long_member_name(
→ → a_very_long_function_name(a_very_long_function_name(42))) {}
```
i.e. indent the continuation line relative to the start of preceding line.
In general, I am of the opinion that with `UseTab: ForContinuationAndIndentation` there must be no lines whose indentation contains spaces; alternatively, there should be a separate `UseTab` option value to that effect.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs