[Lldb-commits] [PATCH] Add a .clang-format file to enhance formatting experience with clang-format

David Majnemer david.majnemer at gmail.com
Tue Jul 22 14:29:29 PDT 2014


On Tue, Jul 22, 2014 at 2:19 PM, <jingham at apple.com> wrote:

> We don't have such a clang-format file.  If somebody can come up with one
> that will run over the extant source base and produce no changes, then I
> guess I'd entertain using it for new code.
>

That is exactly what this patch is trying to do.


>
> I'm not really sure I see the point.  The lldb coding conventions as far
> as braces and the like are pretty straight-forward, and obvious from the
> code around you.  There are slight variations from person to person, but
> I'd rather avoid periodic pointless reformatting checkins as folks run
> these tools over code.


I am certainly not advocating doing that.  clang-format as I, and others,
use it in Clang and LLVM development is generally used to format lines that
I have changed or added as part of a patch.


> More importantly, there's somewhat of an art to laying out code so it
> looks clear and is easy to read.  These tools tend to make uglify such
> attempts, in my experience.
>

clang-format has been, by all accounts that I know of, a smashing success
in Clang and LLVM.  It is regularly used by many of the contributors and is
often explicitly referenced when we see new code up for review that is not
compliant with the coding standards.



>
> Jim
>
>
> > On Jul 22, 2014, at 2:01 PM, David Majnemer <david.majnemer at gmail.com>
> wrote:
> >
> > Hi zturner, tfiala,
> >
> > clang-format is a handy tool that formats code very intelligently.  I'd
> > like to use it with LLDB but it requires a .clang-format file to inform
> > it about LLDB-specific formatting rules.
> >
> > More information on these rules are here:
> > http://clang.llvm.org/docs/ClangFormatStyleOptions.html
> >
> > http://reviews.llvm.org/D4630
> >
> > Files:
> >  .clang-format
> >
> > Index: .clang-format
> > ===================================================================
> > --- /dev/null
> > +++ .clang-format
> > @@ -0,0 +1,5 @@
> > +BasedOnStyle: LLVM
> > +IndentWidth:     4
> > +ColumnLimit:     120
> > +BreakBeforeBraces: Allman
> > +PenaltyReturnTypeOnItsOwnLine: 0
> > <D4630.11784.patch>_______________________________________________
> > lldb-commits mailing list
> > lldb-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20140722/26f275fc/attachment.html>


More information about the lldb-commits mailing list