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

Manuel Klimek klimek at google.com
Mon Jun 22 09:14:39 PDT 2015


On Mon, Jun 22, 2015 at 2:09 AM Xavier Chantry <xavier.chantry at intersec.com>
wrote:

> 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
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150622/6e6cf7b7/attachment.html>


More information about the cfe-dev mailing list