Skip to content

Commit

Permalink
[clang-tidy][NFC][DOC] Use internal references instead of external
Browse files Browse the repository at this point in the history
Use internal references instead of external links to
navigate between checks. This allow to generate proper
hyperlinks when documentation is generated in other
format than html, for example: latex or pdf
  • Loading branch information
PiotrZSL committed Aug 21, 2023
1 parent b441fd6 commit 8407e8a
Show file tree
Hide file tree
Showing 162 changed files with 730 additions and 708 deletions.
14 changes: 10 additions & 4 deletions clang-tools-extra/clang-tidy/add_new_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ def process_doc(doc_file):
def format_link(doc_file):
check_name, match = process_doc(doc_file)
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" % {
return " :doc:`%(check_name)s <%(module)s/%(check)s>`,%(autofix)s\n" % {
"check_name": check_name,
"module": doc_file[0],
"check": doc_file[1].replace(".rst", ""),
Expand All @@ -503,28 +503,34 @@ def format_link_alias(doc_file):
# Preserve the anchor in checkers.html from group 2.
target = "" if not match else match.group(1) + ".html" + match.group(2)
autofix = ""
ref_begin = ""
ref_end = "_"
else:
redirect_parts = re.search("^\.\./([^/]*)/([^/]*)$", match.group(1))
title = redirect_parts[1] + "-" + redirect_parts[2]
target = redirect_parts[1] + "/" + redirect_parts[2] + ".html"
target = redirect_parts[1] + "/" + redirect_parts[2]
autofix = has_auto_fix(title)
ref_begin = ":doc:"
ref_end = ""

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"
" :doc:`%(check_name)s <%(module)s/%(check_file)s>`, %(ref_begin)s`%(title)s <%(target)s>`%(ref_end)s,%(autofix)s\n"
% {
"check_name": check_name,
"module": module,
"check_file": check_file,
"target": target,
"title": title,
"autofix": autofix,
"ref_begin" : ref_begin,
"ref_end" : ref_end
})
else:
# The checker is just a alias without redirect.
return (
" `%(check_name)s <%(module)s/%(check_file)s.html>`_, %(title)s,%(autofix)s\n"
" :doc:`%(check_name)s <%(module)s/%(check_file)s>`, %(title)s,%(autofix)s\n"
% {
"check_name": check_name,
"module": module,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ bugprone-narrowing-conversions
==============================

The bugprone-narrowing-conversions check is an alias, please see
`cppcoreguidelines-narrowing-conversions <../cppcoreguidelines/narrowing-conversions.html>`_
:doc:`cppcoreguidelines-narrowing-conversions <../cppcoreguidelines/narrowing-conversions>`
for more information.
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ Options
By default the following function return types are checked:
`::std::error_code`, `::std::error_condition`, `::std::errc`, `::std::expected`, `::boost::system::error_code`

`cert-err33-c <../cert/err33-c.html>`_ is an alias of this check that checks a
:doc:`cert-err33-c <../cert/err33-c>` is an alias of this check that checks a
fixed and large set of standard library functions.
4 changes: 2 additions & 2 deletions clang-tools-extra/docs/clang-tidy/checks/cert/con36-c.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
cert-con36-c
============

The cert-con36-c check is an alias, please see
`bugprone-spuriously-wake-up-functions <../bugprone/spuriously-wake-up-functions.html>`_
The `cert-con36-c` check is an alias, please see
:doc:`bugprone-spuriously-wake-up-functions <../bugprone/spuriously-wake-up-functions>`
for more information.
4 changes: 2 additions & 2 deletions clang-tools-extra/docs/clang-tidy/checks/cert/con54-cpp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
cert-con54-cpp
==============

The cert-con54-cpp check is an alias, please see
`bugprone-spuriously-wake-up-functions <../bugprone/spuriously-wake-up-functions.html>`_
The `cert-con54-cpp` check is an alias, please see
:doc:`bugprone-spuriously-wake-up-functions <../bugprone/spuriously-wake-up-functions>`
for more information.
4 changes: 2 additions & 2 deletions clang-tools-extra/docs/clang-tidy/checks/cert/dcl03-c.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
cert-dcl03-c
============

The cert-dcl03-c check is an alias, please see
`misc-static-assert <../misc/static-assert.html>`_ for more information.
The `cert-dcl03-c` check is an alias, please see
:doc:`misc-static-assert <../misc/static-assert>` for more information.
4 changes: 2 additions & 2 deletions clang-tools-extra/docs/clang-tidy/checks/cert/dcl16-c.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
cert-dcl16-c
============

The cert-dcl16-c check is an alias, please see
`readability-uppercase-literal-suffix <../readability/uppercase-literal-suffix.html>`_ for more information.
The `cert-dcl16-c` check is an alias, please see
:doc:`readability-uppercase-literal-suffix <../readability/uppercase-literal-suffix>` for more information.
4 changes: 2 additions & 2 deletions clang-tools-extra/docs/clang-tidy/checks/cert/dcl37-c.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
cert-dcl37-c
============

The cert-dcl37-c check is an alias, please see
`bugprone-reserved-identifier <../bugprone/reserved-identifier.html>`_ for more
The `cert-dcl37-c` check is an alias, please see
:doc:`bugprone-reserved-identifier <../bugprone/reserved-identifier>` for more
information.
4 changes: 2 additions & 2 deletions clang-tools-extra/docs/clang-tidy/checks/cert/dcl51-cpp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
cert-dcl51-cpp
==============

The cert-dcl51-cpp check is an alias, please see
`bugprone-reserved-identifier <../bugprone/reserved-identifier.html>`_ for more
The `cert-dcl51-cpp` check is an alias, please see
:doc:`bugprone-reserved-identifier <../bugprone/reserved-identifier>` for more
information.
4 changes: 2 additions & 2 deletions clang-tools-extra/docs/clang-tidy/checks/cert/dcl54-cpp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
cert-dcl54-cpp
==============

The cert-dcl54-cpp check is an alias, please see
`misc-new-delete-overloads <../misc/new-delete-overloads.html>`_ for more
The `cert-dcl54-cpp` check is an alias, please see
:doc:`misc-new-delete-overloads <../misc/new-delete-overloads>` for more
information.
4 changes: 2 additions & 2 deletions clang-tools-extra/docs/clang-tidy/checks/cert/dcl59-cpp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
cert-dcl59-cpp
==============

The cert-dcl59-cpp check is an alias, please see
`google-build-namespaces <../google/build-namespaces.html>`_ for more information.
The `cert-dcl59-cpp` check is an alias, please see
:doc:`google-build-namespaces <../google/build-namespaces>` for more information.
4 changes: 2 additions & 2 deletions clang-tools-extra/docs/clang-tidy/checks/cert/err09-cpp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
cert-err09-cpp
==============

The cert-err09-cpp check is an alias, please see
`misc-throw-by-value-catch-by-reference <../misc/throw-by-value-catch-by-reference.html>`_
The `cert-err09-cpp` check is an alias, please see
:doc:`misc-throw-by-value-catch-by-reference <../misc/throw-by-value-catch-by-reference>`
for more information.

This check corresponds to the CERT C++ Coding Standard recommendation
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/docs/clang-tidy/checks/cert/err33-c.rst
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ functions are checked:
* wscanf()
* wscanf_s()

This check is an alias of check `bugprone-unused-return-value <../bugprone/unused-return-value.html>`_
This check is an alias of check :doc:`bugprone-unused-return-value <../bugprone/unused-return-value>`
with a fixed set of functions.

The check corresponds to a part of CERT C Coding Standard rule `ERR33-C.
Expand Down
4 changes: 2 additions & 2 deletions clang-tools-extra/docs/clang-tidy/checks/cert/err61-cpp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
cert-err61-cpp
==============

The cert-err61-cpp check is an alias, please see
`misc-throw-by-value-catch-by-reference <../misc/throw-by-value-catch-by-reference.html>`_
The `cert-err61-cpp` check is an alias, please see
:doc:`misc-throw-by-value-catch-by-reference <../misc/throw-by-value-catch-by-reference>`
for more information.
4 changes: 2 additions & 2 deletions clang-tools-extra/docs/clang-tidy/checks/cert/exp42-c.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
cert-exp42-c
============

The cert-exp42-c check is an alias, please see
`bugprone-suspicious-memory-comparison <../bugprone/suspicious-memory-comparison.html>`_ for more information.
The `cert-exp42-c` check is an alias, please see
:doc:`bugprone-suspicious-memory-comparison <../bugprone/suspicious-memory-comparison>` for more information.
4 changes: 2 additions & 2 deletions clang-tools-extra/docs/clang-tidy/checks/cert/fio38-c.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
cert-fio38-c
============

The cert-fio38-c check is an alias, please see
`misc-non-copyable-objects <../misc/non-copyable-objects.html>`_ for more
The `cert-fio38-c` check is an alias, please see
:doc:`misc-non-copyable-objects <../misc/non-copyable-objects>` for more
information.
4 changes: 2 additions & 2 deletions clang-tools-extra/docs/clang-tidy/checks/cert/flp37-c.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
cert-flp37-c
============

The cert-flp37-c check is an alias, please see
`bugprone-suspicious-memory-comparison <../bugprone/suspicious-memory-comparison.html>`_ for more information.
The `cert-flp37-c` check is an alias, please see
:doc:`bugprone-suspicious-memory-comparison <../bugprone/suspicious-memory-comparison>` for more information.
4 changes: 2 additions & 2 deletions clang-tools-extra/docs/clang-tidy/checks/cert/msc24-c.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
cert-msc24-c
============

The cert-msc24-c check is an alias, please see
`bugprone-unsafe-functions <../bugprone/unsafe-functions.html>`_ for more
The `cert-msc24-c` check is an alias, please see
:doc:`bugprone-unsafe-functions <../bugprone/unsafe-functions>` for more
information.
4 changes: 2 additions & 2 deletions clang-tools-extra/docs/clang-tidy/checks/cert/msc30-c.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
cert-msc30-c
============

The cert-msc30-c check is an alias, please see
`cert-msc50-cpp <../cert/msc50-cpp.html>`_ for more information.
The `cert-msc30-c` check is an alias, please see
:doc:`cert-msc50-cpp <../cert/msc50-cpp>` for more information.
4 changes: 2 additions & 2 deletions clang-tools-extra/docs/clang-tidy/checks/cert/msc32-c.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
cert-msc32-c
============

The cert-msc32-c check is an alias, please see
`cert-msc51-cpp <../cert/msc51-cpp.html>`_ for more information.
The `cert-msc32-c` check is an alias, please see
:doc:`cert-msc51-cpp <../cert/msc51-cpp>` for more information.
4 changes: 2 additions & 2 deletions clang-tools-extra/docs/clang-tidy/checks/cert/msc33-c.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
cert-msc33-c
============

The cert-msc33-c check is an alias, please see
`bugprone-unsafe-functions <../bugprone/unsafe-functions.html>`_ for more
The `cert-msc33-c` check is an alias, please see
:doc:`bugprone-unsafe-functions <../bugprone/unsafe-functions>` for more
information.
4 changes: 2 additions & 2 deletions clang-tools-extra/docs/clang-tidy/checks/cert/msc54-cpp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
cert-msc54-cpp
==============

The cert-msc54-cpp check is an alias, please see
`bugprone-signal-handler <../bugprone/signal-handler.html>`_
The `cert-msc54-cpp` check is an alias, please see
:doc:`bugprone-signal-handler <../bugprone/signal-handler>`
for more information.
4 changes: 2 additions & 2 deletions clang-tools-extra/docs/clang-tidy/checks/cert/oop11-cpp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
cert-oop11-cpp
==============

The cert-oop11-cpp check is an alias, please see
`performance-move-constructor-init <../performance/move-constructor-init.html>`_
The `cert-oop11-cpp check` is an alias, please see
:doc:`performance-move-constructor-init <../performance/move-constructor-init>`
for more information.

This check corresponds to the CERT C++ Coding Standard recommendation
Expand Down
4 changes: 2 additions & 2 deletions clang-tools-extra/docs/clang-tidy/checks/cert/oop54-cpp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
cert-oop54-cpp
==============

The cert-oop54-cpp check is an alias, please see
`bugprone-unhandled-self-assignment <../bugprone/unhandled-self-assignment.html>`_
The `cert-oop54-cpp` check is an alias, please see
:doc:`bugprone-unhandled-self-assignment <../bugprone/unhandled-self-assignment>`
for more information.
4 changes: 2 additions & 2 deletions clang-tools-extra/docs/clang-tidy/checks/cert/pos44-c.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
cert-pos44-c
============

The cert-pos44-c check is an alias, please see
`bugprone-bad-signal-to-kill-thread <../bugprone/bad-signal-to-kill-thread.html>`_ for more information.
The `cert-pos44-c` check is an alias, please see
:doc:`bugprone-bad-signal-to-kill-thread <../bugprone/bad-signal-to-kill-thread>` for more information.
4 changes: 2 additions & 2 deletions clang-tools-extra/docs/clang-tidy/checks/cert/pos47-c.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
cert-pos47-c
============

The cert-pos47-c check is an alias, please see
`concurrency-thread-canceltype-asynchronous <../concurrency/thread-canceltype-asynchronous.html>`_ for more information.
The `cert-pos47-c` check is an alias, please see
:doc:`concurrency-thread-canceltype-asynchronous <../concurrency/thread-canceltype-asynchronous>` for more information.
4 changes: 2 additions & 2 deletions clang-tools-extra/docs/clang-tidy/checks/cert/sig30-c.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
cert-sig30-c
============

The cert-sig30-c check is an alias, please see
`bugprone-signal-handler <../bugprone/signal-handler.html>`_
The `cert-sig30-c` check is an alias, please see
:doc:`bugprone-signal-handler <../bugprone/signal-handler>`
for more information.
4 changes: 2 additions & 2 deletions clang-tools-extra/docs/clang-tidy/checks/cert/str34-c.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
cert-str34-c
============

The cert-str34-c check is an alias, please see
`bugprone-signed-char-misuse <../bugprone/signed-char-misuse.html>`_
The `cert-str34-c` check is an alias, please see
:doc:`bugprone-signed-char-misuse <../bugprone/signed-char-misuse>`
for more information.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.. title:: clang-tidy - clang-analyzer-core.BitwiseShift
.. meta::
:http-equiv=refresh: 5;URL=https://clang.llvm.org/docs/analyzer/checkers.html#core-bitwiseshift

clang-analyzer-core.BitwiseShift
================================

Finds cases where bitwise shift operation causes undefined behaviour.

The `clang-analyzer-core.BitwiseShift` check is an alias, please see
`Clang Static Analyzer Available Checkers
<https://clang.llvm.org/docs/analyzer/checkers.html#core-bitwiseshift>`_
for more information.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ clang-analyzer-core.CallAndMessage
Check for logical errors for function calls and Objective-C message expressions
(e.g., uninitialized arguments, null function pointers).

The clang-analyzer-core.CallAndMessage check is an alias, please see
The `clang-analyzer-core.CallAndMessage` check is an alias, please see
`Clang Static Analyzer Available Checkers
<https://clang.llvm.org/docs/analyzer/checkers.html#core-callandmessage>`_
for more information.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ clang-analyzer-core.DivideZero

Check for division by zero.

The clang-analyzer-core.DivideZero check is an alias, please see
The `clang-analyzer-core.DivideZero` check is an alias, please see
`Clang Static Analyzer Available Checkers
<https://clang.llvm.org/docs/analyzer/checkers.html#core-dividezero>`_
for more information.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ clang-analyzer-core.NonNullParamChecker
Check for null pointers passed as arguments to a function whose arguments are
references or marked with the 'nonnull' attribute.

The clang-analyzer-core.NonNullParamChecker check is an alias, please see
The `clang-analyzer-core.NonNullParamChecker` check is an alias, please see
`Clang Static Analyzer Available Checkers
<https://clang.llvm.org/docs/analyzer/checkers.html#core-nonnullparamchecker>`_
for more information.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ clang-analyzer-core.NullDereference

Check for dereferences of null pointers.

The clang-analyzer-core.NullDereference check is an alias, please see
The `clang-analyzer-core.NullDereference` check is an alias, please see
`Clang Static Analyzer Available Checkers
<https://clang.llvm.org/docs/analyzer/checkers.html#core-nulldereference>`_
for more information.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ clang-analyzer-core.StackAddressEscape

Check that addresses to stack memory do not escape the function.

The clang-analyzer-core.StackAddressEscape check is an alias, please see
The `clang-analyzer-core.StackAddressEscape` check is an alias, please see
`Clang Static Analyzer Available Checkers
<https://clang.llvm.org/docs/analyzer/checkers.html#core-stackaddressescape>`_
for more information.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ clang-analyzer-core.UndefinedBinaryOperatorResult

Check for undefined results of binary operators.

The clang-analyzer-core.UndefinedBinaryOperatorResult check is an alias, please see
The `clang-analyzer-core.UndefinedBinaryOperatorResult` check is an alias, please see
`Clang Static Analyzer Available Checkers
<https://clang.llvm.org/docs/analyzer/checkers.html#core-undefinedbinaryoperatorresult>`_
for more information.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ clang-analyzer-core.VLASize

Check for declarations of VLA of undefined or zero size.

The clang-analyzer-core.VLASize check is an alias, please see
The `clang-analyzer-core.VLASize` check is an alias, please see
`Clang Static Analyzer Available Checkers
<https://clang.llvm.org/docs/analyzer/checkers.html#core-vlasize>`_
for more information.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ clang-analyzer-core.uninitialized.ArraySubscript

Check for uninitialized values used as array subscripts.

The clang-analyzer-core.uninitialized.ArraySubscript check is an alias, please see
The `clang-analyzer-core.uninitialized.ArraySubscript` check is an alias, please see
`Clang Static Analyzer Available Checkers
<https://clang.llvm.org/docs/analyzer/checkers.html#core-uninitialized-arraysubscript>`_
for more information.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ clang-analyzer-core.uninitialized.Assign

Check for assigning uninitialized values.

The clang-analyzer-core.uninitialized.Assign check is an alias, please see
The `clang-analyzer-core.uninitialized.Assign` check is an alias, please see
`Clang Static Analyzer Available Checkers
<https://clang.llvm.org/docs/analyzer/checkers.html#core-uninitialized-assign>`_
for more information.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ clang-analyzer-core.uninitialized.Branch

Check for uninitialized values used as branch conditions.

The clang-analyzer-core.uninitialized.Branch check is an alias, please see
The `clang-analyzer-core.uninitialized.Branch` check is an alias, please see
`Clang Static Analyzer Available Checkers
<https://clang.llvm.org/docs/analyzer/checkers.html#core-uninitialized-branch>`_
for more information.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ clang-analyzer-core.uninitialized.CapturedBlockVariable

Check for blocks that capture uninitialized values.

The clang-analyzer-core.uninitialized.CapturedBlockVariable check is an alias, please see
The `clang-analyzer-core.uninitialized.CapturedBlockVariable` check is an alias, please see
`Clang Static Analyzer Available Checkers
<https://clang.llvm.org/docs/analyzer/checkers.html#core-uninitialized-capturedblockvariable>`_
for more information.

0 comments on commit 8407e8a

Please sign in to comment.