Open Quuxplusone opened 9 years ago
Consider the following code:
void foo() { while(true) { bar(); } }
When calling
clang-format ./c.cpp -style="{BreakBeforeBraces: Allman}"
or
clang-format ./c.cpp -style="{BreakBeforeBraces: Allman, AllowShortLoopsOnASingleLine: true}"
the result is:
This is the intended result.
clang-format ./cf.cpp -style="{BreakBeforeBraces: Allman, AllowShortLoopsOnASingleLine: true, AllowShortBlocksOnASingleLine: true}"
For some reason, the combination of
BreakBeforeBraces: Allman AllowShortLoopsOnASingleLine: true AllowShortBlocksOnASingleLine: true
makes the braces for loops (and control statements, if the other AllowShort... flags are activated) be indented incorrectly.
AllowShort...
Seems like a bug.
More information: http://stackoverflow.com/questions/32907190/
Error still exists in clang version 3.9.0 (trunk 272270)
Consider the following code:
void foo() { while(true) { bar(); } }
When calling
clang-format ./c.cpp -style="{BreakBeforeBraces: Allman}"
or
clang-format ./c.cpp -style="{BreakBeforeBraces: Allman, AllowShortLoopsOnASingleLine: true}"
the result is:
void foo() { while(true) { bar(); } }
This is the intended result.
When calling
clang-format ./cf.cpp -style="{BreakBeforeBraces: Allman, AllowShortLoopsOnASingleLine: true, AllowShortBlocksOnASingleLine: true}"
the result is:
void foo() { while(true) { bar(); } }
For some reason, the combination of
BreakBeforeBraces: Allman AllowShortLoopsOnASingleLine: true AllowShortBlocksOnASingleLine: true
makes the braces for loops (and control statements, if the other
AllowShort...
flags are activated) be indented incorrectly.Seems like a bug.
More information: http://stackoverflow.com/questions/32907190/