<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/70451>70451</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Prevent clang-format from splitting multiline strings
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang-format
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          MartinsSmirnovs
      </td>
    </tr>
</table>

<pre>
    Sometimes we have to hardcode specific string literals. E. g. some header to append to all messages that are going to be sent or in unit tests when we want to see if the function generates correct string of data. In both cases it is better to split the string into multiple logical pieces using multiline string literal syntax that C++ provides, so we could easily oversee what the resulting string consists of. Following `foo.cpp`:
```
#include <string>

std::string getCode() {
    return "Code\0\52\26\55\55\0x013\02\xBA";
}
```
is much more readable if we split the string into multiple parts:
```
#include <string>

std::string getCode()
{
    return "Code" "\0\52\26\55\55\0" "x013" "\02\xBA";
}
```
However, because of multiline string syntax, clang-format automatically splits such code into multiple lines:
```
$ clang-format foo.cpp 
#include <string>

std::string getCode() {
  return "Code"
 "\0\52\26\55\55\0"
         "x013"
 "\02\xBA";
}

```
Which may be sufficient for some short strings, but is definitely a no-go if there are lots and lots of string parts, resulting in needlessly long column of strings.

I propose to create clang-format flag to disable automatic splitting of multiline strings, and keep/add spaces between the string parts. The flag should not only stop splitting the multiline strings, but also should keep existing split multiline strings as is.

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VU9v47YT_TT0ZRBDpqzYPviQOGv89vADCmyBnilxJLGlOAJnZMffviBlN95km0WBNggk2py_b948G2bXBcS9qp5V9bIwk_QU9_83UVzgb4OLgU68qMle9t9oQHEDMpwRenNCEILeRNuQReARG9e6BliiCx14JxiN5yV8WUK3BKYBoUdjMSY_M44YbD55DwMymw4ZpDcCJiJ0lIIIQY3AGAQoggswBScgyMJw7jGkSs4mSDJkRHAtSI_QTqERRwE6DBiN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