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

Xavier Chantry xavier.chantry at intersec.com
Mon Jun 22 02:02:17 PDT 2015


ping ;)

I know these patches are not very exciting, but it would be interesting 
for us to have them upstream. And we obviously do not want to change the 
default behavior, but add a new option for each item.

On 22/05/2015 19:04, Xavier Chantry wrote:
> 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;
>    end:
>      return;
> }
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list