llvm-project
llvm-project copied to clipboard
[clang-format] `BreakAfterOpenBracketIf` has no effect when function call inside `if` statement is preceded by an unary operator
.clang-format:
ContinuationIndentWidth: 2
BinPackArguments: false
BreakAfterOpenBracketIf: true
BreakBeforeCloseBracketIf: true
C++ file:
#include <cstdio>
int main() {
if (!printf("%s %s %s %s %s %s", "foobar", "foobar", "foobar", "foobar", "foobar", "foobar")) {
return 1;
}
}
Expected formatting:
#include <cstdio>
int main() {
if (
!printf("%s %s %s %s %s %s",
"foobar",
"foobar",
"foobar",
"foobar",
"foobar",
"foobar")
) {
return 1;
}
}
Actual formatting:
#include <cstdio>
int main() {
if (!printf("%s %s %s %s %s %s",
"foobar",
"foobar",
"foobar",
"foobar",
"foobar",
"foobar")) {
return 1;
}
}
Using == false check after printf call instead of ! unary operator results in the correct formatting.
clang-format version is 22.1.8
@llvm/issue-subscribers-clang-format
Author: arthur-cornfield
.clang-format:
```yaml
ContinuationIndentWidth: 2
BinPackArguments: false
BreakAfterOpenBracketIf: true
BreakBeforeCloseBracketIf: true
```
C++ file:
#include <cstdio>
int main() {
if (!printf("%s %s %s %s %s %s", "foobar", "foobar", "foobar", "foobar", "foobar", "foobar")) {
return 1;
}
}
Expected formatting:
#include <cstdio>
int main() {
if (
!printf("%s %s %s %s %s %s",
"foobar",
"foobar",
"foobar",
"foobar",
"foobar",
"foobar")
) {
return 1;
}
}
Actual formatting:
#include <cstdio>
int main() {
if (!printf("%s %s %s %s %s %s",
"foobar",
"foobar",
"foobar",
"foobar",
"foobar",
"foobar")) {
return 1;
}
}
Using == false check after printf call instead of ! unary operator results in the correct formatting.
clang-format version is 22.1.8
Can I be assigned on this? I have a pull request that will resolve this issue.