blob: 3839e703dba5a7b4421be0e676aa131781379d8c [file] [log] [blame]
Sean Silva93ca0212012-12-13 01:10:46 +00001===========
2Clang Tools
3===========
4
5Clang Tools are standalone command line (and potentially GUI) tools
6design for use by C++ developers who are already using and enjoying
7Clang as their compiler. These tools provide developer-oriented
8functionality such as fast syntax checking, automatic formatting,
9refactoring, etc.
10
11Only a couple of the most basic and fundamental tools are kept in the
12primary Clang Subversion project. The rest of the tools are kept in a
13side-project so that developers who don't want or need to build them
14don't. If you want to get access to the extra Clang Tools repository,
15simply check it out into the tools tree of your Clang checkout and
16follow the usual process for building and working with a combined
17LLVM/Clang checkout:
18
19- With Subversion:
20
21 - ``cd llvm/tools/clang/tools``
Sean Silvae30561d2013-01-02 12:40:31 +000022 - ``svn co http://llvm.org/svn/llvm-project/clang-tools-extra/trunk extra``
Sean Silva93ca0212012-12-13 01:10:46 +000023
24- Or with Git:
25
26 - ``cd llvm/tools/clang/tools``
27 - ``git clone http://llvm.org/git/clang-tools-extra.git extra``
28
29This document describes a high-level overview of the organization of
30Clang Tools within the project as well as giving an introduction to some
31of the more important tools. However, it should be noted that this
32document is currently focused on Clang and Clang Tool developers, not on
33end users of these tools.
34
35Clang Tools Organization
36========================
37
38Clang Tools are CLI or GUI programs that are intended to be directly
39used by C++ developers. That is they are *not* primarily for use by
40Clang developers, although they are hopefully useful to C++ developers
41who happen to work on Clang, and we try to actively dogfood their
42functionality. They are developed in three components: the underlying
43infrastructure for building a standalone tool based on Clang, core
44shared logic used by many different tools in the form of refactoring and
45rewriting libraries, and the tools themselves.
46
47The underlying infrastructure for Clang Tools is the
48:doc:`LibTooling <LibTooling>` platform. See its documentation for much
49more detailed information about how this infrastructure works. The
50common refactoring and rewriting toolkit-style library is also part of
51LibTooling organizationally.
52
53A few Clang Tools are developed along side the core Clang libraries as
54examples and test cases of fundamental functionality. However, most of
55the tools are developed in a side repository to provide easy separation
56from the core libraries. We intentionally do not support public
57libraries in the side repository, as we want to carefully review and
58find good APIs for libraries as they are lifted out of a few tools and
59into the core Clang library set.
60
61Regardless of which repository Clang Tools' code resides in, the
62development process and practices for all Clang Tools are exactly those
63of Clang itself. They are entirely within the Clang *project*,
64regardless of the version control scheme.
65
66Core Clang Tools
67================
68
69The core set of Clang tools that are within the main repository are
70tools that very specifically compliment, and allow use and testing of
71*Clang* specific functionality.
72
73``clang-check``
Sean Silva9987ce22013-01-07 21:46:47 +000074---------------
Sean Silva93ca0212012-12-13 01:10:46 +000075
76This tool combines the LibTooling framework for running a Clang tool
77with the basic Clang diagnostics by syntax checking specific files in a
78fast, command line interface. It can also accept flags to re-display the
79diagnostics in different formats with different flags, suitable for use
80driving an IDE or editor. Furthermore, it can be used in fixit-mode to
81directly apply fixit-hints offered by clang.
82
83FIXME: Link to user-oriented clang-check documentation.
84
85Extra Clang Tools
86=================
87
88As various categories of Clang Tools are added to the extra repository,
89they'll be tracked here. The focus of this documentation is on the scope
90and features of the tools for other tool developers; each tool should
91provide its own user-focused documentation.
Dmitri Gribenko2626a2a2013-01-06 20:19:09 +000092
93Ideas for new Tools
Daniel Dunbare3fc0972013-01-07 20:43:06 +000094===================
Dmitri Gribenko2626a2a2013-01-06 20:19:09 +000095
96* C++11 null pointer conversion tool. Will convert all null pointer constants
97 (like ``NULL`` or ``0``) to C++11 ``nullptr``.
98
99* C++ cast conversion tool. Will convert C-style casts (``(type) value``) to
100 appropriate C++ cast (``static_cast``, ``const_cast`` or
101 ``reinterpret_cast``).
102