Issue 52854
Summary Chained method calls aligned 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
```

Observed indentation:
```
struct Foo {
→   Foo &long_named_self_returning_method();
};

int main() {
→   auto foo = Foo{}
→   →   →   →   ···.long_named_self_returning_method()
→   →   →   →   ···.long_named_self_returning_method()
→   →   →   →   ···.long_named_self_returning_method()
→   →   →   →   ···.long_named_self_returning_method();
}
```
Specifically, it looks like continuation lines are indented +4 relative to the _expression_ start `Foo{}`.

Desired indentation:
```
struct Foo {
→   Foo &long_named_self_returning_method();
};

int main() {
→   auto foo = Foo{}
→   →   .long_named_self_returning_method()
→   →   .long_named_self_returning_method()
→   →   .long_named_self_returning_method()
→   →   .long_named_self_returning_method();
}
```
i.e. indent continuation lines relative to the start of preceding line.

I especially consider it a bug to emit the sequence “<tab><space>”. It will break every reader who uses a different tab width.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to