-
Notifications
You must be signed in to change notification settings - Fork 15k
Closed
Copy link
Labels
Description
Bugzilla Link | 52598 |
Version | 13.0 |
OS | Linux |
Extended Description
Consider the following code (file.cpp)
void test() {
if (true) return;
if (true) { return; }
while (true) return;
while (true) { return; }
}
And the following configuration (.clang-format):
Language: Cpp
BreakBeforeBraces: Custom
BraceWrapping:
AfterControlStatement: MultiLine
AllowShortBlocksOnASingleLine: Always
AllowShortLoopsOnASingleLine: true
AllowShortIfStatementsOnASingleLine: WithoutElse
Run clang-format as follows:
clang-format -style=file file.cpp
Produces:
void test() {
if (true) return;
if (true) {
return;
}
while (true) return;
while (true) {
return;
}
}
Expected output: same as input.
Changing AfterControlStatement to Never or Always will produce the expected output. It looks like AfterControlStatement:MultiLine does not respect AllowShortBlocksOnASingleLine setting.