https://bugs.llvm.org/show_bug.cgi?id=35106
Bug ID: 35106
Summary: BreakBeforeBraces and AllowShortBlocksOnASingleLine
interferrs with each other
Product: clang
Version: 5.0
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Formatter
Assignee: unassignedclangb...@nondot.org
Reporter: llvm-b...@skybert.org
CC: djas...@google.com, kli...@google.com,
llvm-bugs@lists.llvm.org
This works as expected:
---
Language: Cpp
BasedOnStyle: LLVM
AllowShortBlocksOnASingleLine: true
AllowShortLoopsOnASingleLine: true
...
int code(std::vector<int> vec) {
int count;
for (auto &el : vec) count++;
for (auto &el : vec) { count++; }
for (auto &el : vec) {
count++;
break;
}
}
This too:
---
Language: Cpp
BasedOnStyle: LLVM
AllowShortLoopsOnASingleLine: true
BreakBeforeBraces: Allman
...
int code(std::vector<int> vec)
{
int count;
for (auto &el : vec) count++;
for (auto &el : vec)
{
count++;
}
for (auto &el : vec)
{
count++;
break;
}
}
Combining these do not work:
---
Language: Cpp
BasedOnStyle: LLVM
AllowShortBlocksOnASingleLine: true
AllowShortLoopsOnASingleLine: true
BreakBeforeBraces: Allman
...
int code(std::vector<int> vec)
{
int count;
for (auto &el : vec) count++;
for (auto &el : vec) {
count++;
}
for (auto &el : vec) {
count++;
break;
}
}
Two errors:
1) All braces on ControlStatements are pulled up instead of following Allman.
2) 'ShortBlock's aren't made
Expected output:
int code(std::vector<int> vec)
{
int count;
for (auto &el : vec) count++;
for (auto &el : vec) { count++; }
for (auto &el : vec)
{
count++;
break;
}
}
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs