[clang-tools-extra] r208979 - Update clang-tidy documentation.
Alexander Kornienko
alexfh at google.com
Fri May 16 06:07:18 PDT 2014
Author: alexfh
Date: Fri May 16 08:07:18 2014
New Revision: 208979
URL: http://llvm.org/viewvc/llvm-project?rev=208979&view=rev
Log:
Update clang-tidy documentation.
Summary:
Updated the help message, updated description of -checks=, removed
mentions of -disable-checks.
Reviewers: klimek
Reviewed By: klimek
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D3793
Modified:
clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp
clang-tools-extra/trunk/docs/clang-tidy.rst
Modified: clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp?rev=208979&r1=208978&r2=208979&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp Fri May 16 08:07:18 2014
@@ -34,29 +34,34 @@ const char DefaultChecks[] =
"-llvm-namespace-comment," // Not complete.
"-google-*,"; // Doesn't apply to LLVM.
static cl::opt<std::string>
-Checks("checks",
- cl::desc("Comma-separated list of positive and negative globs matching\n"
- "the names of the checks to be run."),
+Checks("checks", cl::desc("Comma-separated list of globs with optional '-'\n"
+ "prefix. Globs are processed in order of appearance\n"
+ "in the list. Globs without '-' prefix add checks\n"
+ "with matching names to the set, globs with the '-'\n"
+ "prefix remove checks with matching names from the\n"
+ "set of enabled checks."),
cl::init(""), cl::cat(ClangTidyCategory));
-static cl::opt<std::string> HeaderFilter(
- "header-filter",
- cl::desc("Regular expression matching the names of the headers to output\n"
- "diagnostics from. Diagnostics from the main file of each\n"
- "translation unit are always displayed."),
- cl::init(""), cl::cat(ClangTidyCategory));
+static cl::opt<std::string>
+HeaderFilter("header-filter",
+ cl::desc("Regular expression matching the names of the\n"
+ "headers to output diagnostics from.\n"
+ "Diagnostics from the main file of each\n"
+ "translation unit are always displayed."),
+ cl::init(""), cl::cat(ClangTidyCategory));
static cl::opt<bool> Fix("fix", cl::desc("Fix detected errors if possible."),
cl::init(false), cl::cat(ClangTidyCategory));
-static cl::opt<bool> ListChecks("list-checks",
- cl::desc("List all enabled checks and exit."),
- cl::init(false), cl::cat(ClangTidyCategory));
+static cl::opt<bool>
+ListChecks("list-checks",
+ cl::desc("List all enabled checks and exit. Use with\n"
+ "-checks='*' to list all available checks."),
+ cl::init(false), cl::cat(ClangTidyCategory));
-static cl::opt<bool> AnalyzeTemporaryDtors(
- "analyze-temporary-dtors",
- cl::desc("Enable temporary destructor-aware analysis in clang-analyzer- "
- "checks."),
- cl::init(false),
- cl::cat(ClangTidyCategory));
+static cl::opt<bool>
+AnalyzeTemporaryDtors("analyze-temporary-dtors",
+ cl::desc("Enable temporary destructor-aware analysis in\n"
+ "clang-analyzer- checks."),
+ cl::init(false), cl::cat(ClangTidyCategory));
static void printStats(const clang::tidy::ClangTidyStats &Stats) {
unsigned ErrorsIgnored = Stats.ErrorsIgnoredNOLINT +
Modified: clang-tools-extra/trunk/docs/clang-tidy.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy.rst?rev=208979&r1=208978&r2=208979&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy.rst Fri May 16 08:07:18 2014
@@ -23,12 +23,21 @@ compilation options on the command line
:program:`clang-tidy` has its own checks and can also run Clang static analyzer
checks. Each check has a name and the checks to run can be chosen using the
-``-checks=`` and ``-disable-checks=`` options. :program:`clang-tidy` selects the
-checks with names matching the regular expression specified by the ``-checks=``
-option and not matching the one specified by the ``-disable-checks=`` option.
+``-checks=`` option, which specifies a comma-separated list of positive and
+negative (prefixed with ``-``) globs. Positive globs add subsets of checks,
+negative globs remove them. For example,
-The ``-list-checks`` option lists all the enabled checks. It can be used with or
-without ``-checks=`` and/or ``-disable-checks=``.
+.. code-block:: bash
+
+ $ clang-tidy test.cpp -checks='-*,clang-analyzer-*,-clang-analyzer-alpha*'
+
+will disable all default checks (``-*``) and enable all ``clang-analyzer-*``
+checks except for ``clang-analyzer-alpha*`` ones.
+
+The ``-list-checks`` option lists all the enabled checks. When used without
+``-checks=``, it shows checks enabled by default. Use ``-checks='*'`` to see all
+available checks or with any other value of ``-checks=`` to see which checks are
+enabled by this value.
There are currently three groups of checks:
@@ -38,6 +47,9 @@ There are currently three groups of chec
* Checks related to the Google coding conventions have names starting with
``google-``.
+* Checks with names starting with ``misc-`` don't relate to any particular
+ coding style.
+
* Clang static analyzer checks are named starting with ``clang-analyzer-``.
@@ -63,12 +75,21 @@ An overview of all the command-line opti
clang-tidy options:
- -checks=<string> - Regular expression matching the names of
- the checks to be run.
- -disable-checks=<string> - Regular expression matching the names of
- the checks to disable.
+ -analyze-temporary-dtors - Enable temporary destructor-aware analysis in
+ clang-analyzer- checks.
+ -checks=<string> - Comma-separated list of globs with optional '-'
+ prefix. Globs are processed in order of appearance
+ in the list. Globs without '-' prefix add checks
+ with matching names to the set, globs with the '-'
+ prefix remove checks with matching names from the
+ set of enabled checks.
-fix - Fix detected errors if possible.
- -list-checks - List all enabled checks and exit.
+ -header-filter=<string> - Regular expression matching the names of the
+ headers to output diagnostics from.
+ Diagnostics from the main file of each
+ translation unit are always displayed.
+ -list-checks - List all enabled checks and exit. Use with
+ -checks='*' to list all available checks.
-p=<string> - Build path
-p <build-path> is used to read a compile command database.
More information about the cfe-commits
mailing list