Index: lldb/trunk/.clang-format =================================================================== --- lldb/trunk/.clang-format +++ lldb/trunk/.clang-format @@ -1,6 +1,6 @@ BasedOnStyle: LLVM IndentWidth: 4 -ColumnLimit: 140 +ColumnLimit: 120 BreakBeforeBraces: Allman AlwaysBreakAfterDefinitionReturnType: true AllowShortFunctionsOnASingleLine: Inline Index: lldb/trunk/www/lldb-coding-conventions.html =================================================================== --- lldb/trunk/www/lldb-coding-conventions.html +++ lldb/trunk/www/lldb-coding-conventions.html @@ -20,14 +20,22 @@
-

The lldb coding conventions for the most part follow those used in llvm. For instance the - importance of comments, particularly for defining classes and methods, the restrictions on - features of C++ to use, and the generally excellent advice about using C++ features - properly should all be followed when writing code for lldb. However, lldb does differ - from the llvm coding conventions in several ways. This document outlines the most important ones. - - -

Source code width:

+

The LLDB coding conventions differ in a few important respects from LLVM.

+ +

+ Note that clang-format will deal with + most of this for you, as such is suggested to run on patches before uploading. Note however that + clang-format is not smart enough to detect instances of humans intentionally trying to line variables + up on a particular column boundary, and it will reformat them to remove this "extraneous" whitespace. + While this is usually the correct behavior, LLDB does have many uses of manually aligned types and + fields, so please be aware of this behavior of clang-format when editing this type of code. +

+

+ Important: Where not explicitly outlined below, assume that the + LLVM Coding Conventions are to be followed. +

+ +

Source code width:

lldb does not follow the 80 character line restriction llvm imposes. In our experience, trying to fit C++ code into an 80 character line results in code that is awkward to read, and the time spent trying to find good indentation points to @@ -37,14 +45,16 @@ to make them better fit in 80 characters. In our opinion choosing good descriptive names is much more important than fitting in 80 characters. -

In lldb, we don't have a hard character limit, though we try to keep code statements under - 120 characters because it gets awkward to scan longer lines even on a fairly big monitor, - and we've found at that length you seldom have to make code look ugly to get it to wrap. +

In lldb the limit for code lines is 120 characters because it gets awkward to scan + longer lines even on a fairly big monitor, and we've found at that length you seldom + have to make code look ugly to get it to wrap.

However you will see some instances of longer lines. The most common occurrence is in the options tables for the CommandInterpreter, which contain the help strings as well as a bunch of important but hard to remember fields. These tables are much easier to read if all the fields line up vertically, and don't have help text interleaved in between the lines. + This is another thing to keep in mind when running clang-format, as it will always wrap at + 120, so you will need to tweak its output when running against intentionally too-long lines.

Indentation:

lldb uses 4 character indentation. We find this makes the code structure much easier to Index: lldb/trunk/www/source.html =================================================================== --- lldb/trunk/www/source.html +++ lldb/trunk/www/source.html @@ -18,30 +18,66 @@

-

Downloading LLDB sources

-
-

Obtaining read only access to the LLDB sources is easy:

-
    -
  • svn co http://llvm.org/svn/llvm-project/lldb/trunk lldb
  • -
-

If you prefer using Git, you can check out LLDB from the LLVM git mirror instead:

-
    -
  • git clone http://llvm.org/git/lldb.git
  • -
-
- +

Checking out LLDB sources

+
+

Refer to the LLVM Getting Started Guide + for general instructions on how to check out source. Note that LLDB depends on having a working checkout of LLVM + and Clang, so the first step is to download LLVM and Clang sources as described at the above URL. Then you can + additionally download the LLDB sources from the following repository URLs.

+

SVN Repository: http://llvm.org/svn/llvm-project/lldb/trunk

+

Git Clone: http://llvm.org/git/lldb.git

+

+ For non-Mac platforms, and for MacOSX building with CMake (not Xcode), you should check out your sources to adhere to + the following directory structure: +

  
+                  llvm
+                  |
+                  `-- tools
+                      |
+                      +-- clang
+                      |
+                      `-- lldb
+                
+

+

+ For MacOSX building from Xcode, simply checkout LLDB and then build from Xcode. The Xcode project will + automatically detect that it is a fresh checkout, and checkout LLVM and clang automatically. Unlike other + platforms / build systems, it will use the following directory structure. +

  
+                  lldb
+                  |
+                  `-- llvm
+                      |
+                      +-- tools
+                          |
+                          `-- clang
+                
+            
+ So updating your checkout will consist of updating lldb, llvm, and clang in these locations. +

+

+ Refer to the Build Instructions for more detailed instructions on how to build for a particular + platform / build system combination. +

+

Contributing to LLDB

-

If you wish to contribute to LLDB, you must first get commit access by - requesting commit access

-

Once you have commit access, you will have a USERNAME and you can checkout the sources: - requesting commit access

-
    -
  • svn co https://USERNAME@llvm.org/svn/llvm-project/lldb/trunk lldb
  • -
-
+

+ Please refer to the LLVM Developer Policy + for information about authoring and uploading a patch. LLDB differs from the LLVM Developer Policy in + the following respects. +

    +
  • Coding conventions. Refer to LLDB Coding Conventions.
  • +
  • + Test infrastructure. It is still important to submit tests with your patches, but LLDB uses a different + system for tests. Refer to the lldb/test folder on disk for examples of how to write tests. +
  • +
+ For anything not explicitly listed here, assume that LLDB follows the LLVM policy. +

+