Add documentation redirects for clang-tidy checkers that are exposed under multiple checker names. Updates the Python script for adding checks to properly handle these aliases.

llvm-svn: 257347
This commit is contained in:
Aaron Ballman 2016-01-11 16:48:26 +00:00
parent a0e5cd55ad
commit f5f9bf415c
14 changed files with 89 additions and 6 deletions

View File

@ -215,15 +215,25 @@ void awesome_f2();
# Recreates the list of checks in the docs/clang-tidy/checks directory.
def update_checks_list(module_path):
filename = os.path.normpath(
os.path.join(module_path, '../../docs/clang-tidy/checks/list.rst'))
docs_dir = os.path.join(module_path, '../../docs/clang-tidy/checks')
filename = os.path.normpath(os.path.join(docs_dir, 'list.rst'))
with open(filename, 'r') as f:
lines = f.readlines()
doc_files = filter(
lambda s: s.endswith('.rst') and s != 'list.rst',
os.listdir(docs_dir))
doc_files.sort()
checks = map(lambda s: ' ' + s.replace('.rst', '\n'),
filter(lambda s: s.endswith('.rst') and s != 'list.rst',
os.listdir(os.path.join(module_path, '../../docs/clang-tidy/checks'))))
checks.sort()
def format_link(doc_file):
check_name = doc_file.replace('.rst', '')
with open(os.path.join(docs_dir, doc_file), 'r') as doc:
match = re.search('.*:http-equiv=refresh: \d+;URL=(.*).html.*', doc.read())
if match:
return ' %(check)s (redirects to %(target)s) <%(check)s>\n' % {
'check' : check_name, 'target' : match.group(1) }
return ' %s\n' % check_name
checks = map(format_link, doc_files)
print('Updating %s...' % filename)
with open(filename, 'wb') as f:

View File

@ -0,0 +1,9 @@
.. title:: clang-tidy - cert-dcl03-c
.. meta::
:http-equiv=refresh: 5;URL=misc-static-assert.html
cert-dcl03-c
============
The cert-dcl03-c checker is an alias, please see
`misc-static-assert <misc-static-assert.html>`_ for more information.

View File

@ -0,0 +1,10 @@
.. title:: clang-tidy - cert-dcl54-cpp
.. meta::
:http-equiv=refresh: 5;URL=misc-new-delete-overloads.html
cert-dcl54-cpp
==============
The cert-dcl54-cpp checker is an alias, please see
`misc-new-delete-overloads <misc-new-delete-overloads.html>`_ for more
information.

View File

@ -0,0 +1,9 @@
.. title:: clang-tidy - cert-dcl59-cpp
.. meta::
:http-equiv=refresh: 5;URL=google-build-namespaces.html
cert-dcl59-cpp
==============
The cert-dcl59-cpp checker is an alias, please see
`google-build-namespaces <google-build-namespaces.html>`_ for more information.

View File

@ -0,0 +1,10 @@
.. title:: clang-tidy - cert-err61-cpp
.. meta::
:http-equiv=refresh: 5;URL=misc-throw-by-value-catch-by-reference.html
cert-err61-cpp
==============
The cert-err61-cpp checker is an alias, please see
`misc-throw-by-value-catch-by-reference <misc-throw-by-value-catch-by-reference.html>`_
for more information.

View File

@ -0,0 +1,10 @@
.. title:: clang-tidy - cert-fio38-c
.. meta::
:http-equiv=refresh: 5;URL=misc-non-copyable-objects.html
cert-fio38-c
============
The cert-fio38-c checker is an alias, please see
`misc-non-copyable-objects <misc-non-copyable-objects.html>`_ for more
information.

View File

@ -0,0 +1,10 @@
.. title:: clang-tidy - cert-oop11-cpp
.. meta::
:http-equiv=refresh: 5;URL=misc-move-constructor-init.html
cert-oop11-cpp
==============
The cert-oop11-cpp checker is an alias, please see
`misc-move-constructor-init <misc-move-constructor-init.html>`_ for more
information.

View File

@ -3,6 +3,7 @@
google-build-namespaces
=======================
"cert-dcl59-cpp" redirects here as an alias for this checker.
Finds anonymous namespaces in headers.

View File

@ -4,10 +4,16 @@ Clang-Tidy Checks
=========================
.. toctree::
cert-dcl03-c (redirects to misc-static-assert) <cert-dcl03-c>
cert-dcl50-cpp
cert-dcl54-cpp (redirects to misc-new-delete-overloads) <cert-dcl54-cpp>
cert-dcl59-cpp (redirects to google-build-namespaces) <cert-dcl59-cpp>
cert-err52-cpp
cert-err58-cpp
cert-err60-cpp
cert-err61-cpp (redirects to misc-throw-by-value-catch-by-reference) <cert-err61-cpp>
cert-fio38-c (redirects to misc-non-copyable-objects) <cert-fio38-c>
cert-oop11-cpp (redirects to misc-move-constructor-init) <cert-oop11-cpp>
cppcoreguidelines-pro-bounds-array-to-pointer-decay
cppcoreguidelines-pro-bounds-constant-array-index
cppcoreguidelines-pro-bounds-pointer-arithmetic

View File

@ -3,6 +3,7 @@
misc-move-constructor-init
==========================
"cert-oop11-cpp" redirects here as an alias for this checker.
The check flags user-defined move constructors that have a ctor-initializer
initializing a member or base class through a copy constructor instead of a

View File

@ -3,6 +3,8 @@
misc-new-delete-overloads
=========================
"cert-dcl54-cpp" redirects here as an alias for this checker.
The check flags overloaded operator new() and operator delete() functions that
do not have a corresponding free store function defined within the same scope.
For instance, the check will flag a class implementation of a non-placement

View File

@ -3,6 +3,8 @@
misc-non-copyable-objects
=========================
"cert-fio38-c" redirects here as an alias for this checker.
The check flags dereferences and non-pointer declarations of objects that are
not meant to be passed by value, such as C FILE objects or POSIX
pthread_mutex_t objects.

View File

@ -3,6 +3,7 @@
misc-static-assert
==================
"cert-dcl03-c" redirects here as an alias for this checker.
Replaces ``assert()`` with ``static_assert()`` if the condition is evaluatable
at compile time.

View File

@ -3,6 +3,8 @@
misc-throw-by-value-catch-by-reference
======================================
"cert-err61-cpp" redirects here as an alias for this checker.
Finds violations of the rule "Throw by value, catch by reference" presented for example in "C++ Coding Standards" by H. Sutter and A. Alexandrescu. This check also has the option to find violations of the rule "Throw anonymous temporaries" (https://www.securecoding.cert.org/confluence/display/cplusplus/ERR09-CPP.+Throw+anonymous+temporaries). The option is named "CheckThrowTemporaries" and it's on by default.
Exceptions: