From: NAKAMURA Takumi This document provides some hints for how to get started hacking
on Clang for developers who are new to the Clang and/or LLVM
codebases. Clang follows the
LLVM Coding
Standards. When submitting patches, please take care to follow these standards
@@ -56,14 +56,14 @@
Both Clang and LLVM use doxygen to provide API documentation. Their
respective web pages (generated nightly) are here: For work on the LLVM IR generation, the LLVM assembly language
reference manual is
also useful. Inspecting data structures in a debugger: [Note: The test running mechanism is currently under revision, so the
following might change shortly.] Clang includes a basic regression suite in the tree which can be
run with make test from the top-level clang directory, or
just make in the test sub-directory.
@@ -113,15 +113,15 @@
the test runner that an error is expected at the current line.
Any output files produced by the test will be placed under
a created Output directory. During the run of make test, the terminal output will
display a line similar to the following: followed by a line continually overwritten with the current test
file being compiled, and an overall completion percentage. After the make test run completes, the absence of any
Failing Tests (count): message indicates that no tests
failed unexpectedly. If any tests did fail, the
@@ -148,38 +148,38 @@
override LLVMGCC, as in: make LLVMGCC="clang -std=gnu89"
TEST=nightly report (make sure clang is in your PATH or use the
full path). The Clang test suite can be run from either Visual Studio or
the command line. Note that the test runner is based on
Python, which must be installed. Find Python at:
- http://www.python.org/download.
+ http://www.python.org/download/.
Download the latest stable version (2.6.2 at the time of this writing). The GnuWin32 tools are also necessary for running the tests.
(Note that the grep from MSYS or Cygwin doesn't work with the tests
because of embedded double-quotes in the search strings. The GNU
grep does work in this case.)
- Get them from
- http://getgnuwin32.sourceforge.net.Hacking on Clang
-
+
-
+ Coding Standards
-
+
Developer Documentation
-
+
Debugging
-
+
-
+
Testing
-
+
Testing on Unix-like Systems
-
+
--- Running clang tests for i686-pc-linux-gnu ---
-
+
Testing using Visual Studio on Windows
The cmake build tool is set up to create Visual Studio project files for running the tests, "clang-test" being the root. Therefore, to run the test from Visual Studio, right-click the clang-test project and select "Build".
- +To run all the tests from the command line, execute a command like the following:
- + python (path to llvm)/llvm/utils/lit/lit.py -sv --no-progress-bar (path to llvm)/llvm/tools/clang/test @@ -190,14 +190,14 @@ --param=build_config=(build config).To run a single test:
- + python (path to llvm)/llvm/utils/lit/lit.py -sv --no-progress-bar (path to llvm)/llvm/tools/clang/test/(dir)/(test)For example:
- + python C:/Tools/llvm/utils/lit/lit.py -sv --no-progress-bar C:/Tools/llvm/tools/clang/test/Sema/wchar.c @@ -215,7 +215,7 @@ Testing Time: 81.52s Expected Passes : 2503 Expected Failures : 28 Unsupported Tests : 3 - +The statistic, "Unexpected Failures" (not shown if all tests pass), is the important one.
@@ -230,18 +230,18 @@ Testing Time: 81.52s you are doing, such as if you are new to Clang development, you can use the cfe-dev mailing list also. - +To create these patch files, change directory to the llvm/tools/clang root and run:
- +For example, for getting the diffs of all of clang:
- +For example, for getting the diffs of a single file:
- +Note that the paths embedded in the patch depend on where you run it, @@ -256,7 +256,7 @@ Testing Time: 81.52s Representation (IR). Historically, this was referred to as "codegen", and the Clang code for this lives in lib/CodeGen.
- +The output is most easily inspected using the -emit-llvm option to clang (possibly in conjunction with -o -). You can also use -emit-llvm-bc to write an LLVM bitcode file