Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way with .clang-format to break before one line function?

I can't find anything in the documentation, even BreakBeforeBraces: Allman formats one-line functions that i already split up to

void foo() { bar(); }

I want something similar to

void foo()
{
    bar();
}

I want this for organization of code and uniformity, because this is how every multiline function looks like.

Can you please help me?

like image 232
notADev Avatar asked Jan 26 '23 12:01

notADev


1 Answers

To have a short function body on a separate line add this to the .clang-format file:

AllowShortFunctionsOnASingleLine: Empty
like image 136
Dmitry Avatar answered Jan 28 '23 03:01

Dmitry