[lldb-dev] Formatting rules

Enrico Granata egranata at apple.com
Mon Sep 23 10:42:11 PDT 2013


I don’t think we have a coding style guide (yet - we should have one), and there are some “undefined” areas, or cases where you’ll see difference in style depending on when the code was written.

Main differences I can think of between LLDB and LLVM coding styles:

- 4 spaces instead of 2
- functions are written as

qualifiers RetType
FunctionName (args)
                      ^ space here
{
…
}

- member variables are named m_SomeNiceThingHere and globals g_OneMoreNiceThing

- instead of STL-style iterators, the LLDB convention is to use
size_t GetNumFoos()
Foo GetFooAtIndex(size_t)

- a shared pointer to something is named aSharedPtr_sp, a unique/auto_ptr aUniquePtr_ap, if you want to make a typedef for shared_ptr<Foo> you name it FooSP

Others probably exist that I am forgetting right now...

Enrico Granata
📩 egranata@.com
☎️ 27683

On Sep 23, 2013, at 7:56 AM, Joerg Sonnenberger <joerg at britannica.bec.de> wrote:

> Hi all,
> what are the code formatting rules for LLDB? It is obviously not the
> normal LLVM style, but it doesn't come with a pre-made .clang_format
> config either. There are also inconsistencies in other ways, i.e. LLVM
> normally prefers the C++ wrappers like <cstddef> over stddef.h etc.
> 
> Joerg
> _______________________________________________
> 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/20130923/29063f84/attachment.html>


More information about the lldb-dev mailing list