[cfe-dev] clang-format BreakBeforeBraces: Custom

Nikola Smiljanic via cfe-dev cfe-dev at lists.llvm.org
Wed Feb 3 15:54:06 PST 2016


I don't think you can, clang-format tries to support the most common styles
well, not every conceivable style :)

On Thu, Feb 4, 2016 at 3:30 AM, phi clang via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Hi All,
>
> learning curve is steep :)
>
> From
> CX08$ more c1.c
> struct yo {
> int i;
> int j;
> };
>
> int f(int i, int j)
> { if(i){i++;} else {j++;}
>   return(i+j);
> }
>
> I'd like to get
> CX08$ more c1.c
> struct yo
> { int i;
>   int j;
> };
>
> int f(int i, int j)
> { if(i)
>   { i++;
>   }
>   else
>   { j++;
>     return(i+j);
>   }
> }
>
>
> I found BreakBeforeBraces Allman about ok but has an extra line I don't
> want
>
> CX08$ /home/phi/llvmbuild/bin/clang-format c.c
> struct yo
> { <----- don't want this \n
>   int i;
>   int j;
> };
>
> int f(int i, int j)
> {<----- don't want this \n
>   if (i)
>   {<----- don't want this \n
>     i++;
>   }
>   else
>   {<----- don't want this \n
>     j++;
>   }
>   return (i + j);
> }
>
>
> Any ideas how to tweak .clang-format
>
> Try and fail on all option is a bit slow :)
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160204/ae177c3e/attachment.html>


More information about the cfe-dev mailing list