Open Quuxplusone opened 9 years ago
Bugzilla Link | PR22104 |
Status | REOPENED |
Importance | P normal |
Reported by | Steven Evergreen (evergreenthrowaway@gmail.com) |
Reported on | 2015-01-06 09:56:52 -0800 |
Last modified on | 2019-09-30 12:36:32 -0700 |
Version | unspecified |
Hardware | Macintosh MacOS X |
CC | djasper@google.com, evergreenthrowaway@gmail.com, klimek@google.com, llvm-bugs@lists.llvm.org, mydeveloperday@gmail.com |
Fixed by commit(s) | |
Attachments | |
Blocks | |
Blocked by | |
See also |
On current trunk:
echo 'void f(){for(;;){if(a){}else{}}}' |./bin/clang-format -
style='{"BasedOnStyle": "LLVM", "BreakBeforeBraces": "Allman"}'
void f()
{
for (;;)
{
if (a)
{
}
else
{
}
}
}
Repros with
echo 'void f(){for(;;){if(a){}else{}}}' |./bin/clang-format -style='{"BasedOnStyle": "LLVM", "BreakBeforeBraces": "Allman", "AllowShortBlocksOnASingleLine" : "true", "AllowShortIfStatementsOnASingleLine" : "true", "AllowShortLoopsOnASingleLine" : "true"}'
I realize this is a very old issue, but incase anyone is listening were you
concerned about the "if"?
Surely this comes from the AllowShortBlocksOnASingleLine, are you expecting the
"Allman" setting to override this?
Just trying to assess if this is something we still need to consider?
MyDeveloperDay
$ echo 'void f(){for(;;){if(a){}else{}}}' |./bin/clang-format -
style='{"BasedOnStyle": "LLVM", "BreakBeforeBraces": "Allman",
"AllowShortBlocksOnASingleLine" : "true", "AllowShortIfStatementsOnASingleLine"
: "true", "AllowShortLoopsOnASingleLine" : "true"}'
void f()
{
for (;;)
{
if (a) {}
else
{
}
}
}
vs
$ echo 'void f(){for(;;){if(a){}else{}}}' |./bin/clang-format -
style='{"BasedOnStyle": "LLVM", "BreakBeforeBraces": "Allman",
"AllowShortBlocksOnASingleLine" : "false",
"AllowShortIfStatementsOnASingleLine" : "true", "AllowShortLoopsOnASingleLine"
: "true"}'
void f()
{
for (;;)
{
if (a)
{
}
else
{
}
}
}