I'm trying to achieve the following clang formatings for if and else blocks:
1.For empty blocks, i'd like to keep them (single lined) on the same line as the end of the condition or right after the else, like
1.1
if (true) {}
else {}
1.2
if (true
) {}
else {}
1.3
if (true
) {}
else {}
2.Non-empty blocks should always be wrapped after the control statement and before and after the else
2.1
if (true)
{
;
}
else
{
;
}
2.2
if (true) {}
else
{
;
}
2.3
if (true)
{
;
}
else {}
2.4
if (true)
{
// is this true
}
else
{
/* this might be false */
}
3.but never
3.1.1
if (true) {
;
}
else {
;
}
3.1.2
if (true) {
;
} else {
;
}
3.1.3
if (true)
{
;
} else
{
;
}
3.1.4
if (true)
{
;
} else
{
;
}
3.2.1
if (true) {
}
else {
}
3.2.2
if (true) {
} else {
}
3.2.3
if (true)
{
} else
{
}
3.2.4
if (true)
{
} else
{
}
I'm not able to find a solution for the empty blocks.