0

Is there any option in clang-format to indent the c-preprocessor directives in order to respect the local indentation of a function or any statement? I think it will increase the readability of code in an IDE.

To be clear this

void fun(*args){
  // something
  #if
    // something
  #endif
  // something
}

instead of

void fun(*args){
  // something
#if
    // something
#endif
  // something
}

Update

IndentPPDirectives doesn't satisfy the formatting rule I'm looking for since it just creates an indentation hierarchy in directives like

#if FOO
#  if BAR
#    include <foo>
#  endif
#endif

0 Answers0