| Issue |
97817
|
| Summary |
clang-format: Strange behavior with BreakStringLiterals
|
| Labels |
clang-format
|
| Assignees |
|
| Reporter |
martingalvan-volue
|
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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs