Issue 114538
Summary clang-format: `ColumnLimit: 0` causes various continuation indent bugs, like chained function calls
Labels clang-format
Assignees
Reporter TheJJ
    ## config
`clang-format version 17.0.6`

```
---
BasedOnStyle: LLVM
---
Language: Cpp
UseTab: AlignWithSpaces
IndentWidth: 4
TabWidth: 4
AlignAfterOpenBracket: Align

# this causes the buggy continuation indents
ColumnLimit: 0
---
```

tabs are highlighted with `╺╴╴╴`.

## input (and expected output)
```cpp
int main() {
╺╴╴╴std::cout << "stuff"
╺╴╴╴          << a
╺╴╴╴          << " gnampf";

╺╴╴╴auto chain = a.b()
╺╴╴╴╺╴╴╴.c()
╺╴╴╴╺╴╴╴.d();

╺╴╴╴auto stuffstuff0 = stuff(blsf, eriw);

╺╴╴╴auto stuffstuff1 = stuff(blsf,
╺╴╴╴                         eriw);

╺╴╴╴auto stuffstuff2 = stuff(
╺╴╴╴╺╴╴╴bla,
╺╴╴╴╺╴╴╴iee
╺╴╴╴);

╺╴╴╴auto stuffstuff3 = stuff(
╺╴╴╴╺╴╴╴bla,
╺╴╴╴╺╴╴╴iee
╺╴╴╴).trailcall();
}
```

## output after formatting
```cpp
int main() {
// bug 1: should have alignment spaces to line up <<
╺╴╴╴std::cout << "stuff"
╺╴╴╴╺╴╴╴╺╴╴╴  << a
╺╴╴╴╺╴╴╴╺╴╴╴  << " gnampf";

// bug 2: should just be continuation indent (or a new config option)
╺╴╴╴auto chain = a.b()
╺╴╴╴                 .c()
╺╴╴╴                 .d();

// correct
╺╴╴╴auto stuffstuff0 = stuff(blsf, eriw);

// correct
╺╴╴╴auto stuffstuff1 = stuff(blsf,
╺╴╴╴                         eriw);

// correct, but needs new config item to allow the ) on the next line.
╺╴╴╴auto stuffstuff2 = stuff(
╺╴╴╴╺╴╴╴bla,
╺╴╴╴╺╴╴╴iee);

// bug 3: indent of bla/iee should be just one continuation indent, and .trailcall() should not be indented (probably bug 2)
╺╴╴╴auto stuffstuff3 = stuff(
╺╴╴╴╺╴╴╴╺╴╴╴╺╴╴╴╺╴╴╴╺╴╴╴   bla,
╺╴╴╴╺╴╴╴╺╴╴╴╺╴╴╴╺╴╴╴╺╴╴╴   iee)
╺╴╴╴                       .trailcall();
}
```

## related

#58708 #59797 #55478 
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to