Search code examples
c++clang-format

.clang-format option to customize spacing


I want to configure clang-format to add space after function name and before opening parentheses only for the function definition.

SpaceBeforeParens: Always

this option put space for every if,for loop and function call.

Is there anyway to customize it to put space only when function definition not to put space in case of function call,for,if. I need something as below.

function definition

  int foo () 
  {
    return 0;
  }

function call. (Note there is space between function name and parentheses)

foo();

Solution

  • Unfortunately there is no way to do that thing into only function.