Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make clang-format allow return type of function on its own line

I'm trying to figure out if I can use clang-format to automatically format the code for my project. We have a coding style which enforces newlines after the function return type (but only in the definition, not in the declaration). I'd like to encode this in clang-format.

IOW, I want this:

uint32_t
my_function(uint32_t input)
{
    return 0;
}

Not this:

uint32_t my_function(uint32_t input)
{
    return 0;
}
like image 637
Nathan Avatar asked Oct 28 '15 03:10

Nathan


1 Answers

AlwaysBreakAfterDefinitionReturnType(DRTBS_All) If you add that to the .clang-format file that contains all your formatting decisions it should do exactly what you want.

like image 148
West Avatar answered Nov 14 '22 23:11

West