Issue 76820
Summary Format ellipsis from fold expressions differently from ordinary
Labels clang-format
Assignees
Reporter ilya-biryukov
    Current formatting:
```cpp
void main() {
    ([&final_url, &candidate] {
 FooBarBaz<Url>(candidate, final_url);
        return final_url != std::nullopt;
    }() ||
     ...);
}
```
Suggested formatting:
```cpp
([&final_url, &candidate] {
 FooBarBaz<Url>(candidate, final_url);
    return final_url != std::nullopt;
}() || ...);
```

Currently, the ellipsis is aligned to the same indent as the first argument of `||`.
This would be reasonable if `...` was a normal _expression_, but because `...` has a special meaning in that position and is always fixed length (unlike arbitrary expressions), it seems reasonable to keep it at the same line as `||` to make comprehending the code easier. In particular, we avoid the need to scan the next line to uncover that it's a fold _expression_.

I wonder what other people think and whether it's a useful change to clang-format by default/under a new option?
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to