[lldb-dev] LLDB Coding Style

Kate Stone katherine_stone at apple.com
Wed Aug 20 10:43:45 PDT 2014


I’ve been largely observing the thread, but just so not all the conversations happen internally, I should point out that I’m encouraging the team to go ahead and formalize coding standards so we can publish them to the community.  I’ll strongly discourage ambiguity and guidelines that involve picking one style or another based on “what looks better.”  We should make it clear where we expect conformance from submissions.  Where our existing code base is inconsistent I strongly encourage hewing to established LLVM convention.  We shouldn’t be arbitrarily different, and where we do differ we should be able to describe the specific rationale (as I’m sure Greg will gladly do when it comes to line length and naming conventions.)

I should probably also take a moment to introduce myself!  I manage Apple’s LLDB efforts for Chris as well as the performance tools in Xcode.  Since taking on the team I’ve been largely focused on our Swift efforts, but I do endeavor to keep up with what’s going on in the broader LLDB community.

Kate Stone k8stone at apple.com <mailto:k8stone at apple.com>
 Xcode Runtime Analysis Tools

> On Aug 19, 2014, at 10:16 AM, Zachary Turner <zturner at google.com> wrote:
> 
> I brought this up in a thread on lldb-commits, but since it is of more general interest, I want to make a thread here as well.
> 
> Can we have clear direction on LLDB coding style?  Ideally in the form of an update to lldb.llvm.org <http://lldb.llvm.org/>, but as that might require a little more effort, even some details in a response to this thread would be a help.  Some things I've deduced from looking at the code, and other things I'm not so sure about, because of inconsistencies in the code or just no clear rule.
> 
> Indentation width: 4
> Column limit: 140  (does this apply to comments too?  Most function-declaration comments seem to wrap at 80)
> Brace style: Allman
>     if (foo)
>     {
>         // code here
>     }
> 
> Break after function return type: Always, only on declarations, only on definitions, only in headers, or never?
> 
> Space before function parentheses: When?
> 
> Indent case labels inside switch: A or B below?
>     switch (foo)
>     {
>         case A:
>     case B:
>     }
> 
> Indent braces inside of a case: A or B below?
>     switch (foo)
>     {
>         case A:
>         {
>         }
>         case B:
>             {
>             }
>     }
> 
> Any other rules I should be cognizant of?
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20140820/7c18794e/attachment.html>


More information about the lldb-dev mailing list