[clang] [clang-format] Don't break between string literal operands of << (PR #69871)
    Owen Pan via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Sat Apr 13 22:17:32 PDT 2024
    
    
  
owenca 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  << "}";
> ```
What version was used? I've just tried clang-format 18.1.3, and it's totally fine:
```
$ cat lessless.cpp
osjson << "{\n"
       << "  \"name\": \"value\",\n"
       << "  \"key\": \"abc\", \n"
       << " }";
$ clang-format -version
clang-format version 18.1.3
$ clang-format lessless.cpp | diff lessless.cpp -
$ 
```
https://github.com/llvm/llvm-project/pull/69871
    
    
More information about the cfe-commits
mailing list