[cfe-dev] [clang-format] serie of patches to support specific coding rules

Xavier Chantry xavier.chantry at intersec.com
Fri May 22 10:04:51 PDT 2015

Hello list,

During our last internal hackathon at Intersec, we (a team of 4 intersec 
developers with absolutely no knowledge of clang code) tried to adapt 
clang-format to our coding rules.

We would like to know if this kind of patches could be of interest, or 
if they are all too specific.

Here is a partial list of our patches just to give an idea:

1. Add a space after an assert instruction.

assert (ptr);

This patch is a bit specific but could be generalized to a list of keywords.

2. break line in else if

if (foo) {
} else
if (bar) {

3. "} else {" on the same line

if (foo) {
} else {

4. align logical operators with if and while

if (long_condition1
&&  long_condition2)

Note that the conditions are also aligned.

5. have a regexp instead of a list in IsForEachMacro

The idea is that we have a lot of macros matching ".*_for_each_.*" that 
behaves as a for.

6. extra indent or outdent of label modifiers

void f(void) {
     goto end;

More information about the cfe-dev mailing list