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

via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 9 14:35:27 PDT 2024


mydeveloperday wrote:

I wish we'd made this removal an option rather than just removing it, what we are seeing is reasonably formatted json or xml being streamed out is now poorly written

```c++
osjson << "{\n"
       <<"  \"name\": \"value\",\n"
       <<"  \"key\": \"abc\", \n"
       <<" }";
```

now becomes

```c++
osjson << "{\n" <<"  \"name\": \"value\",\n <<"  \"key\": \"abc\",\n  << "}";
```

While i understand its correct for column width its not as nicer.

These rules about breaking between << were part of the original author rules for now to best try and format c++ and I sort of feel we should at least honour it via an option.

I also feel that this will create a large amount of complaints about us changing defaults.
 

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


More information about the cfe-commits mailing list