[clang-tools-extra] r257347 - 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.
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 11 08:48:26 PST 2016
Author: aaronballman
Date: Mon Jan 11 10:48:26 2016
New Revision: 257347
URL: http://llvm.org/viewvc/llvm-project?rev=257347&view=rev
Log:
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.
Added:
clang-tools-extra/trunk/docs/clang-tidy/checks/cert-dcl03-c.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/cert-dcl54-cpp.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/cert-dcl59-cpp.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/cert-err61-cpp.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/cert-fio38-c.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/cert-oop11-cpp.rst
Modified:
clang-tools-extra/trunk/clang-tidy/add_new_check.py
clang-tools-extra/trunk/docs/clang-tidy/checks/google-build-namespaces.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-move-constructor-init.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-new-delete-overloads.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-non-copyable-objects.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-static-assert.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-throw-by-value-catch-by-reference.rst
Modified: clang-tools-extra/trunk/clang-tidy/add_new_check.py
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/add_new_check.py?rev=257347&r1=257346&r2=257347&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/add_new_check.py (original)
+++ clang-tools-extra/trunk/clang-tidy/add_new_check.py Mon Jan 11 10:48:26 2016
@@ -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:
Added: clang-tools-extra/trunk/docs/clang-tidy/checks/cert-dcl03-c.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/cert-dcl03-c.rst?rev=257347&view=auto
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/cert-dcl03-c.rst (added)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/cert-dcl03-c.rst Mon Jan 11 10:48:26 2016
@@ -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.
Added: clang-tools-extra/trunk/docs/clang-tidy/checks/cert-dcl54-cpp.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/cert-dcl54-cpp.rst?rev=257347&view=auto
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/cert-dcl54-cpp.rst (added)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/cert-dcl54-cpp.rst Mon Jan 11 10:48:26 2016
@@ -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.
Added: clang-tools-extra/trunk/docs/clang-tidy/checks/cert-dcl59-cpp.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/cert-dcl59-cpp.rst?rev=257347&view=auto
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/cert-dcl59-cpp.rst (added)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/cert-dcl59-cpp.rst Mon Jan 11 10:48:26 2016
@@ -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.
Added: clang-tools-extra/trunk/docs/clang-tidy/checks/cert-err61-cpp.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/cert-err61-cpp.rst?rev=257347&view=auto
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/cert-err61-cpp.rst (added)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/cert-err61-cpp.rst Mon Jan 11 10:48:26 2016
@@ -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.
Added: clang-tools-extra/trunk/docs/clang-tidy/checks/cert-fio38-c.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/cert-fio38-c.rst?rev=257347&view=auto
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/cert-fio38-c.rst (added)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/cert-fio38-c.rst Mon Jan 11 10:48:26 2016
@@ -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.
Added: clang-tools-extra/trunk/docs/clang-tidy/checks/cert-oop11-cpp.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/cert-oop11-cpp.rst?rev=257347&view=auto
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/cert-oop11-cpp.rst (added)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/cert-oop11-cpp.rst Mon Jan 11 10:48:26 2016
@@ -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.
Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/google-build-namespaces.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/google-build-namespaces.rst?rev=257347&r1=257346&r2=257347&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/google-build-namespaces.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/google-build-namespaces.rst Mon Jan 11 10:48:26 2016
@@ -3,6 +3,7 @@
google-build-namespaces
=======================
+"cert-dcl59-cpp" redirects here as an alias for this checker.
Finds anonymous namespaces in headers.
Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst?rev=257347&r1=257346&r2=257347&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst Mon Jan 11 10:48:26 2016
@@ -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
Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/misc-move-constructor-init.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/misc-move-constructor-init.rst?rev=257347&r1=257346&r2=257347&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/misc-move-constructor-init.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/misc-move-constructor-init.rst Mon Jan 11 10:48:26 2016
@@ -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
Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/misc-new-delete-overloads.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/misc-new-delete-overloads.rst?rev=257347&r1=257346&r2=257347&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/misc-new-delete-overloads.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/misc-new-delete-overloads.rst Mon Jan 11 10:48:26 2016
@@ -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
Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/misc-non-copyable-objects.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/misc-non-copyable-objects.rst?rev=257347&r1=257346&r2=257347&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/misc-non-copyable-objects.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/misc-non-copyable-objects.rst Mon Jan 11 10:48:26 2016
@@ -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.
Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/misc-static-assert.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/misc-static-assert.rst?rev=257347&r1=257346&r2=257347&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/misc-static-assert.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/misc-static-assert.rst Mon Jan 11 10:48:26 2016
@@ -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.
Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/misc-throw-by-value-catch-by-reference.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/misc-throw-by-value-catch-by-reference.rst?rev=257347&r1=257346&r2=257347&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/misc-throw-by-value-catch-by-reference.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/misc-throw-by-value-catch-by-reference.rst Mon Jan 11 10:48:26 2016
@@ -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:
More information about the cfe-commits
mailing list