<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/97817>97817</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-format: Strange behavior with BreakStringLiterals
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
martingalvan-volue
</td>
</tr>
</table>
<pre>
This happens both on clang-format 17.0.6 and 18.1.18.
My .clang-format file looks like this:
```
AccessModifierOffset: -4
AlignAfterOpenBracket: BlockIndent
BasedOnStyle: Google
BraceWrapping:
AfterControlStatement: MultiLine
BreakAfterAttributes: Always
BreakBeforeBraces: Custom
BreakStringLiterals: false
ColumnLimit: 100
IndentWidth: 4
SortIncludes: Never
```
I have the following code:
```
void f()
{
func("aaaaaaaaaaaaaa")("aaaaaaaaaaaaaa")("aaaaaaaaaaaaaa")("aaaaaaaaaaaaaa")("aaaaaaaaaaaaaa")
("aaaaaaaaaaaaaa")("aaaaaaaaaaaaaa")("aaaaaaaaaaaaaa")("aaaaaaaaaaaaaa")("aaaaaaaaaaaaaa")
("aaaaaaaaaaaaaa");
}
```
If I apply clang-format to it, I see:
```
void f() {
func("aaaaaaaaaaaaaa")("aaaaaaaaaaaaaa")("aaaaaaaaaaaaaa")("aaaaaaaaaaaaaa")("aaaaaaaaaaaaaa")("aaaaaaaaaaaaaa")("aaaaaaaaaaaaaa")("aaaaaaaaaaaaaa")("aaaaaaaaaaaaaa")("aaaaaaaaaaaaaa")(
"aaaaaaaaaaaaaa"
);
}
```
However, if I set `BreakStringLiterals` to `false`, the code is formatted as follows:
```
void f() {
func("aaaaaaaaaaaaaa")("aaaaaaaaaaaaaa")("aaaaaaaaaaaaaa")("aaaaaaaaaaaaaa")("aaaaaaaaaaaaaa")
("aaaaaaaaaaaaaa")("aaaaaaaaaaaaaa")("aaaaaaaaaaaaaa")("aaaaaaaaaaaaaa")("aaaaaaaaaaaaaa")
("aaaaaaaaaaaaaa");
}
```
which is what I want.
How is `BreakStringLiterals` related to this at all? None of the formatting outputs end up breaking the strings, which is what that setting is supposed to control.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcVl2PqzYQ_TXmZbTImJCPBx5IVmkj7d59SKX7bGAAN8ZG9pAo_74ycG831fa2fam2jSKieM58eI7PGOm9ag1izrI9y54jOVJnXd5LR8q0Ul-lebpaPWJU2vqe_9IpD50cBjQeSksdWAOVlqZ9aqzrJUGyiXm8BmlqSLZxEifbmPFnxov5-XqH-AHfKI2grb140OqCQJ3yLC3e-7A1X77T36Kq0PtXW6tGoXtrGo_E0gKeVotdq9YUDaF7G9DsnawuM2CvbXU5mRoNzci99Fi_mTPdNQbAT9a2GhebkxV-dXIYlGm_FwQwBT5YQ87qM0nCPoRLC3gdNakXZb77o7xM4ILIqXIkDPuCQt_k3b_D7LGxDqd0E-AwerL9O8CZnDLtiyJ0Uk-QRmq_pDlYPfbmRfVqKiLhS5PmbX5VNXVhfWnN2To6mUqP9ZzrC17RfdjkJQp08ho4QWis1vamTAuVrfHHDF2tqqFhYsvEbgFs9ksDm9FUk0XIhw8TIqD_LctczH-hkHT_rYXPP2KqgRPIYdD3RzmSBUVMHOAEHv8BbfDpGPsUlm9sfQBY5gPA3yftZ3ubBCgOoJqJIQK25h-pfs0DlWzNZ-2veXAKugxqBOVh5puwBukXsf7FHP3cdP_fBHrrVNUFom6dJDjBTRqK_3AYgvnP-XeoZeCX7HRJgiSQWrP0CF-sQbDNMqencxAGtR1pGMkDmhrGAcoQNqwHmJ_C-3CKHiuj8PA4R1Ae_DgM1s9pq_nai6M6T-tdupMR5slG8GTLRZpFXV5zkchVJXC7SptSCBQiQ8HrKpVY4iaLVC64WPENz5Ik42kWJ5XYcZ4kuF5tBKY7tuLYS6Vjra99bF0bKe9HzHebbbKJtCxR--ldRYj3cy5QkT1HLg9uT-XYerbiWnnyvwciRRrzB6-0gDM5aVqEEjt5VdbBTVEHH1AQjU7nHdEwyUocmTi2irqxjCvbM3EMeZafp8HZX7EiJo5T9Z6J47yBay5-CwAA__8F3c2Q">