aaron.ballman updated this revision to Diff 44507.
aaron.ballman marked 2 inline comments as done.
aaron.ballman added a comment.

Adds the add_new_check.py changes from Alex, regenerates list.rst from the 
Python script.


http://reviews.llvm.org/D15796

Files:
  clang-tidy/add_new_check.py
  docs/clang-tidy/checks/cert-dcl03-c.rst
  docs/clang-tidy/checks/cert-dcl54-cpp.rst
  docs/clang-tidy/checks/cert-dcl59-cpp.rst
  docs/clang-tidy/checks/cert-err61-cpp.rst
  docs/clang-tidy/checks/cert-fio38-c.rst
  docs/clang-tidy/checks/cert-oop11-cpp.rst
  docs/clang-tidy/checks/google-build-namespaces.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/misc-move-constructor-init.rst
  docs/clang-tidy/checks/misc-new-delete-overloads.rst
  docs/clang-tidy/checks/misc-non-copyable-objects.rst
  docs/clang-tidy/checks/misc-static-assert.rst
  docs/clang-tidy/checks/misc-throw-by-value-catch-by-reference.rst

Index: docs/clang-tidy/checks/misc-throw-by-value-catch-by-reference.rst
===================================================================
--- docs/clang-tidy/checks/misc-throw-by-value-catch-by-reference.rst
+++ docs/clang-tidy/checks/misc-throw-by-value-catch-by-reference.rst
@@ -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:
Index: docs/clang-tidy/checks/misc-static-assert.rst
===================================================================
--- docs/clang-tidy/checks/misc-static-assert.rst
+++ docs/clang-tidy/checks/misc-static-assert.rst
@@ -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.
Index: docs/clang-tidy/checks/misc-non-copyable-objects.rst
===================================================================
--- docs/clang-tidy/checks/misc-non-copyable-objects.rst
+++ docs/clang-tidy/checks/misc-non-copyable-objects.rst
@@ -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.
Index: docs/clang-tidy/checks/misc-new-delete-overloads.rst
===================================================================
--- docs/clang-tidy/checks/misc-new-delete-overloads.rst
+++ docs/clang-tidy/checks/misc-new-delete-overloads.rst
@@ -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
Index: docs/clang-tidy/checks/misc-move-constructor-init.rst
===================================================================
--- docs/clang-tidy/checks/misc-move-constructor-init.rst
+++ docs/clang-tidy/checks/misc-move-constructor-init.rst
@@ -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
Index: docs/clang-tidy/checks/list.rst
===================================================================
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -4,10 +4,16 @@
 =========================
 
 .. 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
Index: docs/clang-tidy/checks/google-build-namespaces.rst
===================================================================
--- docs/clang-tidy/checks/google-build-namespaces.rst
+++ docs/clang-tidy/checks/google-build-namespaces.rst
@@ -3,6 +3,7 @@
 google-build-namespaces
 =======================
 
+"cert-dcl59-cpp" redirects here as an alias for this checker.
 
 Finds anonymous namespaces in headers.
 
Index: docs/clang-tidy/checks/cert-oop11-cpp.rst
===================================================================
--- docs/clang-tidy/checks/cert-oop11-cpp.rst
+++ docs/clang-tidy/checks/cert-oop11-cpp.rst
@@ -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.
Index: docs/clang-tidy/checks/cert-fio38-c.rst
===================================================================
--- docs/clang-tidy/checks/cert-fio38-c.rst
+++ docs/clang-tidy/checks/cert-fio38-c.rst
@@ -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.
Index: docs/clang-tidy/checks/cert-err61-cpp.rst
===================================================================
--- docs/clang-tidy/checks/cert-err61-cpp.rst
+++ docs/clang-tidy/checks/cert-err61-cpp.rst
@@ -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.
Index: docs/clang-tidy/checks/cert-dcl59-cpp.rst
===================================================================
--- docs/clang-tidy/checks/cert-dcl59-cpp.rst
+++ docs/clang-tidy/checks/cert-dcl59-cpp.rst
@@ -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.
Index: docs/clang-tidy/checks/cert-dcl54-cpp.rst
===================================================================
--- docs/clang-tidy/checks/cert-dcl54-cpp.rst
+++ docs/clang-tidy/checks/cert-dcl54-cpp.rst
@@ -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.
Index: docs/clang-tidy/checks/cert-dcl03-c.rst
===================================================================
--- docs/clang-tidy/checks/cert-dcl03-c.rst
+++ docs/clang-tidy/checks/cert-dcl03-c.rst
@@ -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.
Index: clang-tidy/add_new_check.py
===================================================================
--- clang-tidy/add_new_check.py
+++ clang-tidy/add_new_check.py
@@ -215,16 +215,26 @@
 
 # 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:
     for line in lines:
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to