[llvm-bugs] [Bug 52598] New: BraceWrapping.AfterControlStatement: MultiLine breaks AllowShortXXXX settings
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Nov 24 08:07:09 PST 2021
https://bugs.llvm.org/show_bug.cgi?id=52598
Bug ID: 52598
Summary: BraceWrapping.AfterControlStatement: MultiLine breaks
AllowShortXXXX settings
Product: clang
Version: 13.0
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Formatter
Assignee: unassignedclangbugs at nondot.org
Reporter: kyrylo.bohdanenko at gmail.com
CC: djasper at google.com, klimek at google.com,
llvm-bugs at lists.llvm.org
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211124/0122f788/attachment-0001.html>
More information about the llvm-bugs
mailing list