[clang] [clang-format] Don't break between string literal operands of << (PR #69871)

Petr Hosek via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 26 22:54:11 PDT 2023


petrhosek wrote:

We have noticed that after this change, `clang-format` would behave differently depending on the input formatting.

(I'm using `--style="{BasedOnStyle: google, ColumnLimit: 0}"` in the examples below.)

For example, if the input is
```
return os << "ClientEnd<"
          << "test_anonymous::SomeProtocol"
          << ">(" << value.channel().get() << ")";
```
the output format would be the same before and after this change.

However, if the input is
```
return os << "ClientEnd<" << "test_anonymous::SomeProtocol" << ">(" << value.channel().get() << ")";
```
prior to this change we would reformat it as
```
return os << "ClientEnd<"
          << "test_anonymous::SomeProtocol"
          << ">(" << value.channel().get() << ")";
```
but after this change we would format it as
```
return os << "ClientEnd<" << "test_anonymous::SomeProtocol" << ">(" << value.channel().get() << ")";
```
that is the same as input.

Is that behavior intentional?

https://github.com/llvm/llvm-project/pull/69871


More information about the cfe-commits mailing list