From: serge-sans-paille Date: Tue, 8 Sep 2020 12:38:16 +0000 (+0200) Subject: [clang-tidy] Fix reST syntax X-Git-Tag: llvmorg-13-init~12478 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=875b8537eea0662ead820979f18c83d5e31b4b8b;p=platform%2Fupstream%2Fllvm.git [clang-tidy] Fix reST syntax Authored by Eisuke Kawashima [https://github.com/llvm/llvm-project/pull/245] --- diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone-argument-comment.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone-argument-comment.rst index 8484c39..8c59541 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/bugprone-argument-comment.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone-argument-comment.rst @@ -29,6 +29,7 @@ Options account. .. option:: IgnoreSingleArgument + When true, the check will ignore the single argument. .. option:: CommentBoolLiterals diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone-exception-escape.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone-exception-escape.rst index 9c7f113..52f3cef 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/bugprone-exception-escape.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone-exception-escape.rst @@ -5,6 +5,7 @@ bugprone-exception-escape Finds functions which may throw an exception directly or indirectly, but they should not. The functions which should not throw exceptions are the following: + * Destructors * Move constructors * Move assignment operators diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone-forwarding-reference-overload.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone-forwarding-reference-overload.rst index 61255e7..b2a9e0f 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/bugprone-forwarding-reference-overload.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone-forwarding-reference-overload.rst @@ -37,7 +37,7 @@ The check warns for constructors C1 and C2, because those can hide copy and move constructors. We suppress warnings if the copy and the move constructors are both disabled (deleted or private), because there is nothing the perfect forwarding constructor could hide in this case. We also suppress warnings for constructors -like C3 that are guarded with an enable_if, assuming the programmer was aware of +like C3 that are guarded with an ``enable_if``, assuming the programmer was aware of the possible hiding. Background @@ -45,5 +45,5 @@ Background For deciding whether a constructor is guarded with enable_if, we consider the default values of the type parameters and the types of the constructor -parameters. If any part of these types is std::enable_if or std::enable_if_t, we -assume the constructor is guarded. +parameters. If any part of these types is ``std::enable_if`` or ``std::enable_if_t``, +we assume the constructor is guarded. diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone-lambda-function-name.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone-lambda-function-name.rst index 683977a..6f0ba83 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/bugprone-lambda-function-name.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone-lambda-function-name.rst @@ -10,7 +10,7 @@ is almost never what was intended. Example: .. code-block:: c++ - + void FancyFunction() { [] { printf("Called from %s\n", __func__); }(); [] { printf("Now called from %s\n", __FUNCTION__); }(); diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone-not-null-terminated-result.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone-not-null-terminated-result.rst index 9e5a702..54e4826 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/bugprone-not-null-terminated-result.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone-not-null-terminated-result.rst @@ -5,7 +5,7 @@ bugprone-not-null-terminated-result Finds function calls where it is possible to cause a not null-terminated result. Usually the proper length of a string is ``strlen(src) + 1`` or equal length of -this expression, because the null terminator needs an extra space. Without the +this expression, because the null terminator needs an extra space. Without the null terminator it can result in undefined behaviour when the string is read. The following and their respective ``wchar_t`` based functions are checked: @@ -17,27 +17,27 @@ The following is a real-world example where the programmer forgot to increase the passed third argument, which is ``size_t length``. That is why the length of the allocated memory is not enough to hold the null terminator. - .. code-block:: c +.. code-block:: c - static char *stringCpy(const std::string &str) { - char *result = reinterpret_cast(malloc(str.size())); - memcpy(result, str.data(), str.size()); - return result; - } + static char *stringCpy(const std::string &str) { + char *result = reinterpret_cast(malloc(str.size())); + memcpy(result, str.data(), str.size()); + return result; + } In addition to issuing warnings, fix-it rewrites all the necessary code. It also tries to adjust the capacity of the destination array: - .. code-block:: c +.. code-block:: c - static char *stringCpy(const std::string &str) { - char *result = reinterpret_cast(malloc(str.size() + 1)); - strcpy(result, str.data()); - return result; - } + static char *stringCpy(const std::string &str) { + char *result = reinterpret_cast(malloc(str.size() + 1)); + strcpy(result, str.data()); + return result; + } Note: It cannot guarantee to rewrite every of the path-sensitive memory - allocations. +allocations. .. _MemcpyTransformation: diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone-suspicious-include.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone-suspicious-include.rst index 237823c..3c05f39 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/bugprone-suspicious-include.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone-suspicious-include.rst @@ -19,7 +19,7 @@ Options ------- .. option:: HeaderFileExtensions - Default value: `";h;hh;hpp;hxx"` + Default value: ``";h;hh;hpp;hxx"`` A semicolon-separated list of filename extensions of header files (the filename extensions should not contain a "." prefix). For extension-less header files, use an empty string or leave an empty string between ";" @@ -27,6 +27,6 @@ Options .. option:: ImplementationFileExtensions - Default value: `"c;cc;cpp;cxx"` + Default value: ``"c;cc;cpp;cxx"`` Likewise, a semicolon-separated list of filename extensions of implementation files. diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone-suspicious-missing-comma.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone-suspicious-missing-comma.rst index 9fe9153..7455a2e 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/bugprone-suspicious-missing-comma.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone-suspicious-missing-comma.rst @@ -46,14 +46,14 @@ Options .. option:: SizeThreshold An unsigned integer specifying the minimum size of a string literal to be - considered by the check. Default is `5U`. + considered by the check. Default is ``5U``. .. option:: RatioThreshold A string specifying the maximum threshold ratio [0, 1.0] of suspicious string - literals to be considered. Default is `".2"`. + literals to be considered. Default is ``".2"``. .. option:: MaxConcatenatedTokens An unsigned integer specifying the maximum number of concatenated tokens. - Default is `5U`. + Default is ``5U``. diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone-terminating-continue.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone-terminating-continue.rst index 1a6ae81..222de90 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/bugprone-terminating-continue.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone-terminating-continue.rst @@ -3,15 +3,15 @@ bugprone-terminating-continue ============================= -Detects `do while` loops with a condition always evaluating to false that -have a `continue` statement, as this `continue` terminates the loop +Detects ``do while`` loops with a condition always evaluating to false that +have a ``continue`` statement, as this ``continue`` terminates the loop effectively. .. code-block:: c++ void f() { do { - // some code + // some code continue; // terminating continue // some other code } while(false); diff --git a/clang-tools-extra/docs/clang-tidy/checks/cert-con36-c.rst b/clang-tools-extra/docs/clang-tidy/checks/cert-con36-c.rst index 7d74e05..6fabd14 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/cert-con36-c.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/cert-con36-c.rst @@ -1,10 +1,10 @@ .. title:: clang-tidy - cert-con36-c .. meta:: :http-equiv=refresh: 5;URL=bugprone-spuriously-wake-up-functions.html - + cert-con36-c ============ The cert-con36-c check is an alias, please see -`bugprone-spuriously-wake-up-functions `_ +`bugprone-spuriously-wake-up-functions `_ for more information. diff --git a/clang-tools-extra/docs/clang-tidy/checks/cert-con54-cpp.rst b/clang-tools-extra/docs/clang-tidy/checks/cert-con54-cpp.rst index f74bc44..ff9237e 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/cert-con54-cpp.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/cert-con54-cpp.rst @@ -1,10 +1,10 @@ .. title:: clang-tidy - cert-con54-cpp .. meta:: :http-equiv=refresh: 5;URL=bugprone-spuriously-wake-up-functions.html - + cert-con54-cpp ============== The cert-con54-cpp check is an alias, please see -`bugprone-spuriously-wake-up-functions `_ +`bugprone-spuriously-wake-up-functions `_ for more information. diff --git a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-avoid-non-const-global-variables.rst b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-avoid-non-const-global-variables.rst index 4d1ffde..53dafc7 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-avoid-non-const-global-variables.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-avoid-non-const-global-variables.rst @@ -3,8 +3,8 @@ cppcoreguidelines-avoid-non-const-global-variables ================================================== -Finds non-const global variables as described in `I.2 of C++ Core Guidelines ` . -As `R.6 of C++ Core Guidelines ` is a duplicate of rule I.2 it also covers that rule. +Finds non-const global variables as described in `I.2 of C++ Core Guidelines `_ . +As `R.6 of C++ Core Guidelines `_ is a duplicate of rule I.2 it also covers that rule. .. code-block:: c++ diff --git a/clang-tools-extra/docs/clang-tidy/checks/google-objc-global-variable-declaration.rst b/clang-tools-extra/docs/clang-tidy/checks/google-objc-global-variable-declaration.rst index e4b41fb..15b5999 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/google-objc-global-variable-declaration.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/google-objc-global-variable-declaration.rst @@ -9,8 +9,8 @@ pattern of variable names in Google's Objective-C Style Guide. The corresponding style guide rule: https://google.github.io/styleguide/objcguide.html#variable-names -All the global variables should follow the pattern of `g[A-Z].*` (variables) or -`k[A-Z].*` (constants). The check will suggest a variable name that follows the +All the global variables should follow the pattern of ``g[A-Z].*`` (variables) or +``k[A-Z].*`` (constants). The check will suggest a variable name that follows the pattern if it can be inferred from the original name. For code: diff --git a/clang-tools-extra/docs/clang-tidy/checks/google-readability-casting.rst b/clang-tools-extra/docs/clang-tidy/checks/google-readability-casting.rst index 4c9d1bc..d927e1c 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/google-readability-casting.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/google-readability-casting.rst @@ -9,6 +9,6 @@ https://google.github.io/styleguide/cppguide.html#Casting Corresponding cpplint.py check name: `readability/casting`. -This check is similar to `-Wold-style-cast`, but it suggests automated fixes +This check is similar to ``-Wold-style-cast``, but it suggests automated fixes in some cases. The reported locations should not be different from the -ones generated by `-Wold-style-cast`. +ones generated by ``-Wold-style-cast``. diff --git a/clang-tools-extra/docs/clang-tidy/checks/misc-misplaced-const.rst b/clang-tools-extra/docs/clang-tidy/checks/misc-misplaced-const.rst index e583ecb..3b21a87 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/misc-misplaced-const.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/misc-misplaced-const.rst @@ -8,7 +8,7 @@ This check diagnoses when a ``const`` qualifier is applied to a ``typedef``/ are often misleading to developers because the ``const`` applies to the pointer rather than the pointee. -For instance, in the following code, the resulting type is ``int *`` ``const`` +For instance, in the following code, the resulting type is ``int * const`` rather than ``const int *``: .. code-block:: c++ diff --git a/clang-tools-extra/docs/clang-tidy/checks/misc-no-recursion.rst b/clang-tools-extra/docs/clang-tidy/checks/misc-no-recursion.rst index dad6f74..c8281075 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/misc-no-recursion.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/misc-no-recursion.rst @@ -9,10 +9,12 @@ diagnoses each function in the cycle, and displays one example of a possible call graph loop (recursion). References: + * CERT C++ Coding Standard rule `DCL56-CPP. Avoid cycles during initialization of static objects `_. * JPL Institutional Coding Standard for the C Programming Language (JPL DOCID D-60411) rule `2.4 Do not use direct or indirect recursion`. * OpenCL Specification, Version 1.2 rule `6.9 Restrictions: i. Recursion is not supported. `_. Limitations: + * The check does not handle calls done through function pointers * The check does not handle C++ destructors diff --git a/clang-tools-extra/docs/clang-tidy/checks/misc-unused-parameters.rst b/clang-tools-extra/docs/clang-tidy/checks/misc-unused-parameters.rst index 3dfeb29..d954c1d 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/misc-unused-parameters.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/misc-unused-parameters.rst @@ -8,7 +8,7 @@ code (e.g. when a different parameter is used instead). The suggested fixes either comment parameter name out or remove the parameter completely, if all callers of the function are in the same translation unit and can be updated. -The check is similar to the `-Wunused-parameter` compiler diagnostic and can be +The check is similar to the ``-Wunused-parameter`` compiler diagnostic and can be used to prepare a codebase to enabling of that diagnostic. By default the check is more permissive (see :option:`StrictMode`). diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize-replace-disallow-copy-and-assign-macro.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize-replace-disallow-copy-and-assign-macro.rst index 6717c92..c1c8ace 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/modernize-replace-disallow-copy-and-assign-macro.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/modernize-replace-disallow-copy-and-assign-macro.rst @@ -37,7 +37,7 @@ Known Limitations ----------------- * Notice that the migration example above leaves the ``private`` access - specification untouched. You might want to run the check:doc:`modernize-use-equals-delete + specification untouched. You might want to run the check :doc:`modernize-use-equals-delete ` to get warnings for deleted functions in private sections. diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize-use-noexcept.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize-use-noexcept.rst index 084dad7..8addc8b 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/modernize-use-noexcept.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/modernize-use-noexcept.rst @@ -15,25 +15,25 @@ Example .. code-block:: c++ void foo() throw(); - void bar() throw(int) {} + void bar() throw(int) {} transforms to: .. code-block:: c++ void foo() noexcept; - void bar() noexcept(false) {} + void bar() noexcept(false) {} Options ------- .. option:: ReplacementString -Users can use :option:`ReplacementString` to specify a macro to use -instead of ``noexcept``. This is useful when maintaining source code -that uses custom exception specification marking other than -``noexcept``. Fix-it hints will only be generated for non-throwing -specifications. + Users can use :option:`ReplacementString` to specify a macro to use + instead of ``noexcept``. This is useful when maintaining source code + that uses custom exception specification marking other than + ``noexcept``. Fix-it hints will only be generated for non-throwing + specifications. Example ^^^^^^^ diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize-use-uncaught-exceptions.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize-use-uncaught-exceptions.rst index 615f2e3..d10556f 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/modernize-use-uncaught-exceptions.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/modernize-use-uncaught-exceptions.rst @@ -12,53 +12,53 @@ they will be replaced with. .. code-block:: c++ - #define MACRO1 std::uncaught_exception - #define MACRO2 std::uncaught_exception - - int uncaught_exception() { - return 0; - } - - int main() { - int res; - - res = uncaught_exception(); - // No warning, since it is not the deprecated function from namespace std - - res = MACRO2(); - // Warning, but will not be replaced - - res = std::uncaught_exception(); - // Warning and replaced - - using std::uncaught_exception; - // Warning and replaced - - res = uncaught_exception(); - // Warning and replaced - } + #define MACRO1 std::uncaught_exception + #define MACRO2 std::uncaught_exception + + int uncaught_exception() { + return 0; + } + + int main() { + int res; + + res = uncaught_exception(); + // No warning, since it is not the deprecated function from namespace std + + res = MACRO2(); + // Warning, but will not be replaced + + res = std::uncaught_exception(); + // Warning and replaced + + using std::uncaught_exception; + // Warning and replaced + + res = uncaught_exception(); + // Warning and replaced + } After applying the fixes the code will look like the following: .. code-block:: c++ - #define MACRO1 std::uncaught_exception - #define MACRO2 std::uncaught_exception - - int uncaught_exception() { - return 0; - } - - int main() { - int res; - - res = uncaught_exception(); - - res = MACRO2(); - - res = std::uncaught_exceptions(); - - using std::uncaught_exceptions; - - res = uncaught_exceptions(); - } + #define MACRO1 std::uncaught_exception + #define MACRO2 std::uncaught_exception + + int uncaught_exception() { + return 0; + } + + int main() { + int res; + + res = uncaught_exception(); + + res = MACRO2(); + + res = std::uncaught_exceptions(); + + using std::uncaught_exceptions; + + res = uncaught_exceptions(); + } diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability-const-return-type.rst b/clang-tools-extra/docs/clang-tidy/checks/readability-const-return-type.rst index e236d8d..6242e43 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/readability-const-return-type.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/readability-const-return-type.rst @@ -11,7 +11,7 @@ return types. Examples: .. code-block:: c++ - + const int foo(); const Clazz foo(); Clazz *const foo(); diff --git a/clang-tools-extra/docs/clang-tidy/checks/zircon-temporary-objects.rst b/clang-tools-extra/docs/clang-tidy/checks/zircon-temporary-objects.rst index 7491f77..ab1225f 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/zircon-temporary-objects.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/zircon-temporary-objects.rst @@ -3,12 +3,12 @@ zircon-temporary-objects ======================== -Warns on construction of specific temporary objects in the Zircon kernel. -If the object should be flagged, If the object should be flagged, the fully +Warns on construction of specific temporary objects in the Zircon kernel. +If the object should be flagged, If the object should be flagged, the fully qualified type name must be explicitly passed to the check. -For example, given the list of classes "Foo" and "NS::Bar", all of the -following will trigger the warning: +For example, given the list of classes "Foo" and "NS::Bar", all of the +following will trigger the warning: .. code-block:: c++ @@ -26,14 +26,14 @@ With the same list, the following will not trigger the warning: .. code-block:: c++ - Foo F; // Non-temporary construction okay - Foo F(param); // Non-temporary construction okay - Foo *F = new Foo(); // New construction okay + Foo F; // Non-temporary construction okay + Foo F(param); // Non-temporary construction okay + Foo *F = new Foo(); // New construction okay - Bar(); // Not NS::Bar, so okay - NS::Bar B; // Non-temporary construction okay + Bar(); // Not NS::Bar, so okay + NS::Bar B; // Non-temporary construction okay -Note that objects must be explicitly specified in order to be flagged, +Note that objects must be explicitly specified in order to be flagged, and so objects that inherit a specified object will not be flagged. This check matches temporary objects without regard for inheritance and so a @@ -49,5 +49,5 @@ Options .. option:: Names - A semi-colon-separated list of fully-qualified names of C++ classes that + A semi-colon-separated list of fully-qualified names of C++ classes that should not be constructed as temporaries. Default is empty.