Update build instructions / coding conventions.
authorZachary Turner <zturner@google.com>
Tue, 10 Mar 2015 23:22:25 +0000 (23:22 +0000)
committerZachary Turner <zturner@google.com>
Tue, 10 Mar 2015 23:22:25 +0000 (23:22 +0000)
This improves the instructions for checking out LLDB, adds
more links to LLVM instructions, and more explicitly calls out
when we differ from the style guide.

Also updates the clang-format configuration file to correctly
reflect a 120 column limit.

Reviewed by: Jim Ingham
Differential Revision: http://reviews.llvm.org/D8222

llvm-svn: 231884

lldb/.clang-format
lldb/www/lldb-coding-conventions.html
lldb/www/source.html

index 4ce7c87..b0ffd2c 100644 (file)
@@ -1,6 +1,6 @@
 BasedOnStyle: LLVM
 IndentWidth:     4
-ColumnLimit:     140
+ColumnLimit:     120
 BreakBeforeBraces: Allman
 AlwaysBreakAfterDefinitionReturnType: true
 AllowShortFunctionsOnASingleLine: Inline
index 6851d7b..7cd959c 100644 (file)
                                <div class="postcontent">
 
 
-                                  <p>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.
-
-                                    
-                                      <h3>Source code width:</h3>
+                                  <p>The LLDB coding conventions differ in a few important respects from LLVM.</p>
+                                  
+                                  <p>\r
+                                    Note that <a href="http://clang.llvm.org/docs/ClangFormat.html">clang-format</a> will deal with\r
+                                    most of this for you, as such is suggested to run on patches before uploading.  Note however that\r
+                                    clang-format is not smart enough to detect instances of humans intentionally trying to line variables\r
+                                    up on a particular column boundary, and it will reformat them to remove this "extraneous" whitespace.\r
+                                    While this is usually the correct behavior, LLDB does have many uses of manually aligned types and\r
+                                    fields, so please be aware of this behavior of clang-format when editing this type of code.\r
+                                  </p>\r
+                                  <p>\r
+                                    <b>Important</b>: Where not explicitly outlined below, assume that the\r
+                                    <a href="http://llvm.org/docs/CodingStandards.html">LLVM Coding Conventions</a> are to be followed.\r
+                                  </p>\r
+\r
+                                      <h3>Source code width:</h3>\r
                                       <p>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
                                         to make them better fit in 80 characters.  In our opinion choosing good descriptive 
                                         names is much more important than fitting in 80 characters.
                                         
-                                      <p>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.
+                                      <p>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.
                                         
                                       <p>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.
                                         
                                       <h3>Indentation:</h3>
                                       <p>lldb uses 4 character indentation.  We find this makes the code structure much easier to
index 2138cd4..a92fdb5 100755 (executable)
 
                <div id="middle">
                        <div class="post">
-                               <h1 class ="postheader">Downloading LLDB sources</h1>
-                               <div class="postcontent">
-                                       <p>Obtaining read only access to the LLDB sources is easy:</p>
-                                       <ul>
-                                               <li>svn co http://llvm.org/svn/llvm-project/lldb/trunk lldb</li>
-                                       </ul>
-                                       <p>If you prefer using Git, you can check out LLDB from the <a href="http://llvm.org/docs/GettingStarted.html#git-mirror">LLVM git mirror</a> instead:</p>
-                                       <ul>
-                                               <li>git clone http://llvm.org/git/lldb.git</li>
-                                       </ul>
-                               </div>
-                               <div class="postfooter"></div>
+                               <h1 class ="postheader">Checking out LLDB sources</h1>
+        <div class="postcontent">
+          <p>Refer to the <a href="http://llvm.org/docs/GettingStarted.html#getting-started-with-llvm">LLVM Getting Started Guide</a>
+             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.</p>
+          <p><b>SVN Repository</b>: http://llvm.org/svn/llvm-project/lldb/trunk </p>
+          <p><b>Git Clone</b>: http://llvm.org/git/lldb.git </p>
+          <p>
+            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:
+            <pre><tt>  \r
+                  llvm\r
+                  |\r
+                  `-- tools\r
+                      |\r
+                      +-- clang\r
+                      |\r
+                      `-- lldb\r
+                </tt></pre>\r
+          </p>
+          <p>\r
+            For MacOSX building from Xcode, simply checkout LLDB and then build from Xcode.  The Xcode project will\r
+            automatically detect that it is a fresh checkout, and checkout LLVM and clang automatically.  Unlike other\r
+            platforms / build systems, it will use the following directory structure.\r
+            <pre><tt>  \r
+                  lldb\r
+                  |\r
+                  `-- llvm\r
+                      |\r
+                      +-- tools\r
+                          |\r
+                          `-- clang\r
+                </tt>\r
+            </pre>\r
+            So updating your checkout will consist of updating lldb, llvm, and clang in these locations.\r
+          </p>\r
+          <p>\r
+            Refer to the <a href="build.html">Build Instructions</a> for more detailed instructions on how to build for a particular\r
+            platform / build system combination.\r
+          </p>
+        </div>
                        </div>
                        <div class="post">
                                <h1 class ="postheader">Contributing to LLDB</h1>
                                <div class="postcontent">
-                                       <p>If you wish to contribute to LLDB, you must first get commit access by
-                                               <a href="http://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access">requesting commit access</a></p>
-                                       <p>Once you have commit access, you will have a <b>USERNAME</b> and you can checkout the sources:
-                                                       <a href="http://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access">requesting commit access</a></p>
-                                       <ul>
-                                               <li>svn co https://USERNAME@llvm.org/svn/llvm-project/lldb/trunk lldb</li>
-                                       </ul>
-                               </div>
+          <p>\r
+            Please refer to the <a href="http://llvm.org/docs/DeveloperPolicy.html">LLVM Developer Policy</a>\r
+            for information about authoring and uploading a patch.  LLDB differs from the LLVM Developer Policy in\r
+            the following respects.\r
+            <ul>\r
+              <li>Coding conventions.  Refer to <a href="lldb-coding-conventions.html">LLDB Coding Conventions</a>.</li>\r
+              <li>\r
+                Test infrastructure.  It is still important to submit tests with your patches, but LLDB uses a different\r
+                system for tests.  Refer to the lldb/test folder on disk for examples of how to write tests.\r
+              </li>\r
+            </ul>\r
+            For anything not explicitly listed here, assume that LLDB follows the LLVM policy.\r
+          </p>
+        </div>
                                <div class="postfooter"></div>
                        </div>
                </div>