Formatting rules

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

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 you name it FooSP

Others probably exist that I am forgetting right now…

Enrico Granata
:envelope_with_arrow: egranata@.com
:phone: 27683