<div dir="ltr">Hi all,<div><br><div>I've written a working draft for a new clang-format option "PPDirectiveIndentation" (available at <a href="https://github.com/mkurdej/clang/tree/indent-pp-directives">https://github.com/mkurdej/clang/tree/indent-pp-directives</a>).</div><div>Basically, it indents preprocessor directives. So, the code</div><div><br></div><div>#if 0</div><div>#define A</div><div>#endif</div><div><br></div><div>becomes</div><div><br></div><div>#if 0</div><div>#   define A</div><div>#endif</div><div><br></div><div>when PPDirectiveIndentation = All.</div><div><br></div><div>So far, there are only two options (None, All), but I foresee another option Inner or something like that to mimic the behaviour of NamespaceIndentation.</div><div>The number of spaces between '#' and the directive name is controlled by IndentWidth option (to be consistent with indentation inside namespaces, classes, blocks etc.), but it may be easily modified.</div><div><br></div><div>What's the interest in it? Among well known source code that indents preprocessor directives, there are many Boost libraries (a quick search shows e.g. <a href="https://github.com/boostorg/asio/blob/develop/include/boost/asio/buffer.hpp">https://github.com/boostorg/asio/blob/develop/include/boost/asio/buffer.hpp</a>).</div><div>What are the chances that it gets merged?</div><div><br></div><div>I'll submit the code for revision to Phabricator this week when I find some more time.</div><div><br></div><div>Best regards,</div><div>Marek</div></div></div><div dir="ltr">-- <br></div><div data-smartmail="gmail_signature"><div dir="ltr">Marek</div></div>