[llvm-bugs] [Bug 46633] New: Invalid handling of AfterControlStatement: MultiLine
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jul 8 04:03:09 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=46633
Bug ID: 46633
Summary: Invalid handling of AfterControlStatement: MultiLine
Product: clang
Version: 10.0
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Formatter
Assignee: unassignedclangbugs at nondot.org
Reporter: varqox at gmail.com
CC: djasper at google.com, klimek at google.com,
llvm-bugs at lists.llvm.org
With the following .clang-format file:
====================
Language: Cpp
BreakBeforeBraces: Custom
BraceWrapping:
AfterControlStatement: MultiLine
ColumnLimit: 80
IndentWidth: 4
====================
running clang-format on
====================
void foo() {
if (very_long_variable_name or other_very_long_variable_name or
long_variable)
{
return;
}
}
====================
produces:
====================
void foo() {
if (very_long_variable_name or other_very_long_variable_name or
long_variable) {
return;
}
}
====================
Expected output: the same as input.
Command used: clang-format bug.cc
clang-format version: 10.0.0
Additional notes:
If you change "long_variable)" to "long_variable123)" or "long_variab)"
formatting is correct -- the brace gets wrapped. So it seems that if an if
condition ends slightly after the column limit (if placed in a single line),
then it is formatted incorrectly.
--
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/20200708/59760c9f/attachment.html>
More information about the llvm-bugs
mailing list