Author: Piotr Zegar Date: 2023-08-11T11:02:28Z New Revision: cd9e92309d1733219f439d663ec9a4c3d59e6650
URL: https://github.com/llvm/llvm-project/commit/cd9e92309d1733219f439d663ec9a4c3d59e6650 DIFF: https://github.com/llvm/llvm-project/commit/cd9e92309d1733219f439d663ec9a4c3d59e6650.diff LOG: [clang-tidy][NFC] Update add_new_check.py to handle more proper list.rst Update script to generate list.rst in format that is in-sync with gen-static-analyzer-docs.py. Re-generate list.rst. Added: Modified: clang-tools-extra/clang-tidy/add_new_check.py clang-tools-extra/docs/clang-tidy/checks/list.rst Removed: ################################################################################ diff --git a/clang-tools-extra/clang-tidy/add_new_check.py b/clang-tools-extra/clang-tidy/add_new_check.py index c642000eba2283..520212883d9976 100755 --- a/clang-tools-extra/clang-tidy/add_new_check.py +++ b/clang-tools-extra/clang-tidy/add_new_check.py @@ -483,7 +483,7 @@ def process_doc(doc_file): def format_link(doc_file): check_name, match = process_doc(doc_file) - if not match and check_name: + if not match and check_name and not check_name.startswith("clang-analyzer-"): return " `%(check_name)s <%(module)s/%(check)s.html>`_,%(autofix)s\n" % { "check_name": check_name, "module": doc_file[0], @@ -495,13 +495,13 @@ def format_link(doc_file): def format_link_alias(doc_file): check_name, match = process_doc(doc_file) - if match and check_name: + if (match or (check_name.startswith("clang-analyzer-"))) and check_name: module = doc_file[0] check_file = doc_file[1].replace(".rst", "") - if match.group(1) == "https://clang.llvm.org/docs/analyzer/checkers": + if not match or match.group(1) == "https://clang.llvm.org/docs/analyzer/checkers": title = "Clang Static Analyzer " + check_file # Preserve the anchor in checkers.html from group 2. - target = match.group(1) + ".html" + match.group(2) + target = "" if not match else match.group(1) + ".html" + match.group(2) autofix = "" else: redirect_parts = re.search("^\.\./([^/]*)/([^/]*)$", match.group(1)) @@ -509,18 +509,30 @@ def format_link_alias(doc_file): target = redirect_parts[1] + "/" + redirect_parts[2] + ".html" autofix = has_auto_fix(title) - # The checker is just a redirect. - return ( - " `%(check_name)s <%(module)s/%(check_file)s.html>`_, `%(title)s <%(target)s>`_,%(autofix)s\n" - % { - "check_name": check_name, - "module": module, - "check_file": check_file, - "target": target, - "title": title, - "autofix": autofix, - } - ) + if target: + # The checker is just a redirect. + return ( + " `%(check_name)s <%(module)s/%(check_file)s.html>`_, `%(title)s <%(target)s>`_,%(autofix)s\n" + % { + "check_name": check_name, + "module": module, + "check_file": check_file, + "target": target, + "title": title, + "autofix": autofix, + }) + else: + # The checker is just a alias without redirect. + return ( + " `%(check_name)s <%(module)s/%(check_file)s.html>`_, %(title)s,%(autofix)s\n" + % { + "check_name": check_name, + "module": module, + "check_file": check_file, + "target": target, + "title": title, + "autofix": autofix, + }) return "" checks = map(format_link, doc_files) diff --git a/clang-tools-extra/docs/clang-tidy/checks/list.rst b/clang-tools-extra/docs/clang-tidy/checks/list.rst index f4c835247ab9ed..6dfdf34e9d026f 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/list.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/list.rst @@ -165,26 +165,6 @@ Clang-Tidy Checks `cert-msc51-cpp <cert/msc51-cpp.html>`_, `cert-oop57-cpp <cert/oop57-cpp.html>`_, `cert-oop58-cpp <cert/oop58-cpp.html>`_, - `clang-analyzer-core.DynamicTypePropagation <clang-analyzer/core.DynamicTypePropagation.html>`_, - `clang-analyzer-core.uninitialized.CapturedBlockVariable <clang-analyzer/core.uninitialized.CapturedBlockVariable.html>`_, - `clang-analyzer-cplusplus.InnerPointer <clang-analyzer/cplusplus.InnerPointer.html>`_, - `clang-analyzer-nullability.NullableReturnedFromNonnull <clang-analyzer/nullability.NullableReturnedFromNonnull.html>`_, - `clang-analyzer-optin.osx.OSObjectCStyleCast <clang-analyzer/optin.osx.OSObjectCStyleCast.html>`_, - `clang-analyzer-optin.performance.GCDAntipattern <clang-analyzer/optin.performance.GCDAntipattern.html>`_, - `clang-analyzer-optin.performance.Padding <clang-analyzer/optin.performance.Padding.html>`_, - `clang-analyzer-optin.portability.UnixAPI <clang-analyzer/optin.portability.UnixAPI.html>`_, - `clang-analyzer-osx.MIG <clang-analyzer/osx.MIG.html>`_, - `clang-analyzer-osx.NumberObjectConversion <clang-analyzer/osx.NumberObjectConversion.html>`_, - `clang-analyzer-osx.OSObjectRetainCount <clang-analyzer/osx.OSObjectRetainCount.html>`_, - `clang-analyzer-osx.ObjCProperty <clang-analyzer/osx.ObjCProperty.html>`_, - `clang-analyzer-osx.cocoa.AutoreleaseWrite <clang-analyzer/osx.cocoa.AutoreleaseWrite.html>`_, - `clang-analyzer-osx.cocoa.Loops <clang-analyzer/osx.cocoa.Loops.html>`_, - `clang-analyzer-osx.cocoa.MissingSuperCall <clang-analyzer/osx.cocoa.MissingSuperCall.html>`_, - `clang-analyzer-osx.cocoa.NonNilReturnValue <clang-analyzer/osx.cocoa.NonNilReturnValue.html>`_, - `clang-analyzer-osx.cocoa.RunLoopAutoreleaseLeak <clang-analyzer/osx.cocoa.RunLoopAutoreleaseLeak.html>`_, - `clang-analyzer-valist.CopyToSelf <clang-analyzer/valist.CopyToSelf.html>`_, - `clang-analyzer-valist.Uninitialized <clang-analyzer/valist.Uninitialized.html>`_, - `clang-analyzer-valist.Unterminated <clang-analyzer/valist.Unterminated.html>`_, `concurrency-mt-unsafe <concurrency/mt-unsafe.html>`_, `concurrency-thread-canceltype-asynchronous <concurrency/thread-canceltype-asynchronous.html>`_, `cppcoreguidelines-avoid-capturing-lambda-coroutines <cppcoreguidelines/avoid-capturing-lambda-coroutines.html>`_, @@ -255,7 +235,7 @@ Clang-Tidy Checks `llvm-twine-local <llvm/twine-local.html>`_, "Yes" `llvmlibc-callee-namespace <llvmlibc/callee-namespace.html>`_, `llvmlibc-implementation-in-namespace <llvmlibc/implementation-in-namespace.html>`_, - `llvmlibc-inline-function-decl <llvmlibc/inline-function-decl.html>`_, + `llvmlibc-inline-function-decl <llvmlibc/inline-function-decl.html>`_, "Yes" `llvmlibc-restrict-system-libc-headers <llvmlibc/restrict-system-libc-headers.html>`_, "Yes" `misc-confusable-identifiers <misc/confusable-identifiers.html>`_, `misc-const-correctness <misc/const-correctness.html>`_, "Yes" _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits