[clang-tools-extra] r279494 - Fix style in some Clang-tidy checks documentation.

Eugene Zelenko via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 22 17:19:43 PDT 2016


Author: eugenezelenko
Date: Mon Aug 22 19:19:43 2016
New Revision: 279494

URL: http://llvm.org/viewvc/llvm-project?rev=279494&view=rev
Log:
Fix style in some Clang-tidy checks documentation.

Differential revision: https://reviews.llvm.org/D23728

Modified:
    clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-constant-array-index.rst
    clang-tools-extra/trunk/docs/clang-tidy/checks/google-global-names-in-headers.rst
    clang-tools-extra/trunk/docs/clang-tidy/checks/misc-argument-comment.rst
    clang-tools-extra/trunk/docs/clang-tidy/checks/misc-misplaced-widening-cast.rst
    clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-missing-comma.rst
    clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-auto.rst
    clang-tools-extra/trunk/docs/clang-tidy/checks/readability-braces-around-statements.rst

Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-constant-array-index.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-constant-array-index.rst?rev=279494&r1=279493&r2=279494&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-constant-array-index.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-constant-array-index.rst Mon Aug 22 19:19:43 2016
@@ -6,10 +6,15 @@ cppcoreguidelines-pro-bounds-constant-ar
 This check flags all array subscript expressions on static arrays and
 ``std::arrays`` that either do not have a constant integer expression index or
 are out of bounds (for ``std::array``). For out-of-bounds checking of static
-arrays, see the clang-diagnostic-array-bounds check.
-
-The check can generate fixes after the option `GslHeader` has been set
-to the name of the include file that contains ``gsl::at()``, e.g. `"gsl/gsl.h"`.
+arrays, see the `-Warray-bounds` Clang diagnostic.
 
 This rule is part of the "Bounds safety" profile of the C++ Core Guidelines, see
 https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Pro-bounds-arrayindex.
+
+Options
+-------
+
+.. option:: GslHeader
+
+   The check can generate fixes after this option has been set to the name of
+   the include file that contains ``gsl::at()``, e.g. `"gsl/gsl.h"`.

Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/google-global-names-in-headers.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/google-global-names-in-headers.rst?rev=279494&r1=279493&r2=279494&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/google-global-names-in-headers.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/google-global-names-in-headers.rst Mon Aug 22 19:19:43 2016
@@ -3,15 +3,18 @@
 google-global-names-in-headers
 ==============================
 
-Flag global namespace pollution in header files.
-Right now it only triggers on ``using`` declarations and directives.
-
-The check supports these options:
-  - `HeaderFileExtensions`: a comma-separated list of filename extensions
-    of header files (the filename extensions should not contain "." prefix).
-    "h" by default.
-    For extension-less header files, using an empty string or leaving an
-    empty string between "," if there are other filename extensions.
+Flag global namespace pollution in header files. Right now it only triggers on
+``using`` declarations and directives.
 
 The relevant style guide section is
 https://google.github.io/styleguide/cppguide.html#Namespaces.
+
+Options
+-------
+
+.. option:: HeaderFileExtensions
+
+   A comma-separated list of filename extensions of header files (the filename
+   extensions should not contain "." prefix). "h" by default. For extension-less
+   header files, using an empty string or leaving an empty string between ","
+   if there are other filename extensions.

Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/misc-argument-comment.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/misc-argument-comment.rst?rev=279494&r1=279493&r2=279494&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/misc-argument-comment.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/misc-argument-comment.rst Mon Aug 22 19:19:43 2016
@@ -3,22 +3,26 @@
 misc-argument-comment
 =====================
 
-
 Checks that argument comments match parameter names.
 
 The check understands argument comments in the form ``/*parameter_name=*/``
 that are placed right before the argument.
 
-.. code:: c++
+.. code-block:: c++
 
   void f(bool foo);
 
   ...
+
   f(/*bar=*/true);
   // warning: argument name 'bar' in comment does not match parameter name 'foo'
 
 The check tries to detect typos and suggest automated fixes for them.
 
-Supported options:
-  - `StrictMode` (local or global): when non-zero, the check will ignore leading
-    and trailing underscores and case when comparing parameter names.
+Options
+-------
+
+.. option:: StrictMode
+
+   When non-zero, the check will ignore leading and trailing underscores and
+   case when comparing parameter names.

Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/misc-misplaced-widening-cast.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/misc-misplaced-widening-cast.rst?rev=279494&r1=279493&r2=279494&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/misc-misplaced-widening-cast.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/misc-misplaced-widening-cast.rst Mon Aug 22 19:19:43 2016
@@ -8,21 +8,25 @@ type. If the intention of the cast is to
 is misplaced, and there can be loss of precision. Otherwise the cast is
 ineffective.
 
-Example code::
+Example code:
+
+.. code-block:: c++
 
     long f(int x) {
-        return (long)(x*1000);
+        return (long)(x * 1000);
     }
 
-The result x*1000 is first calculated using int precision. If the result
-exceeds int precision there is loss of precision. Then the result is casted to
-long.
+The result ``x * 1000`` is first calculated using ``int`` precision. If the
+result exceeds ``int`` precision there is loss of precision. Then the result is
+casted to ``long``.
 
 If there is no loss of precision then the cast can be removed or you can
-explicitly cast to int instead.
+explicitly cast to ``int`` instead.
 
 If you want to avoid loss of precision then put the cast in a proper location,
-for instance::
+for instance:
+
+.. code-block:: c++
 
     long f(int x) {
         return (long)x * 1000;
@@ -32,8 +36,10 @@ Implicit casts
 --------------
 
 Forgetting to place the cast at all is at least as dangerous and at least as
-common as misplacing it. If option ``CheckImplicitCasts`` is enabled (default)
-the checker also detects these cases, for instance::
+common as misplacing it. If :option:`CheckImplicitCasts` is enabled the check
+also detects these cases, for instance:
+
+.. code-block:: c++
 
     long f(int x) {
         return x * 1000;
@@ -43,8 +49,17 @@ Floating point
 --------------
 
 Currently warnings are only written for integer conversion. No warning is
-written for this code::
+written for this code:
+
+.. code-block:: c++
 
     double f(float x) {
         return (double)(x * 10.0f);
     }
+
+Options
+-------
+
+.. option:: CheckImplicitCasts
+
+   If non-zero, enables detection of implicit casts. Default is non-zero.

Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-missing-comma.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-missing-comma.rst?rev=279494&r1=279493&r2=279494&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-missing-comma.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-missing-comma.rst Mon Aug 22 19:19:43 2016
@@ -9,16 +9,15 @@ literal on multiple lines.
 
 For instance, the following declarations are equivalent:
 
-.. code:: c++
+.. code-block:: c++
 
   const char* A[] = "This is a test";
   const char* B[] = "This" " is a "    "test";
 
-
 A common mistake done by programmers is to forget a comma between two string
 literals in an array initializer list.
 
-.. code:: c++
+.. code-block:: c++
 
   const char* Test[] = {
     "line 1",
@@ -28,17 +27,15 @@ literals in an array initializer list.
     "line 5"
   };
 
-
 The array contains the string "line 2line3" at offset 1 (i.e. Test[1]). Clang
 won't generate warnings at compile time.
 
-This checker may warn incorrectly on cases like:
+This check may warn incorrectly on cases like:
 
-.. code:: c++
+.. code-block:: c++
 
   const char* SupportedFormat[] = {
     "Error %s",
     "Code " PRIu64,   // May warn here.
     "Warning %s",
   };
-

Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-auto.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-auto.rst?rev=279494&r1=279493&r2=279494&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-auto.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-auto.rst Mon Aug 22 19:19:43 2016
@@ -145,16 +145,20 @@ the following conditions are satisfied:
 
 Known Limitations
 -----------------
+
 * If the initializer is an explicit conversion constructor, the check will not
   replace the type specifier even though it would be safe to do so.
 
 * User-defined iterators are not handled at this time.
 
-RemoveStars option
-------------------
-If the option is set to non-zero (default is `0`), the check will remove stars
-from the non-typedef pointer types when replacing type names with ``auto``.
-Otherwise, the check will leave stars. For example:
+Options
+-------
+
+.. option:: RemoveStars
+
+   If the option is set to non-zero (default is `0`), the check will remove
+   stars from the non-typedef pointer types when replacing type names with
+   ``auto``. Otherwise, the check will leave stars. For example:
 
 .. code-block:: c++
 

Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/readability-braces-around-statements.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/readability-braces-around-statements.rst?rev=279494&r1=279493&r2=279494&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/readability-braces-around-statements.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/readability-braces-around-statements.rst Mon Aug 22 19:19:43 2016
@@ -11,14 +11,14 @@ Checks that bodies of ``if`` statements
 
 Before:
 
-.. code:: c++
+.. code-block:: c++
 
   if (condition)
     statement;
 
 After:
 
-.. code:: c++
+.. code-block:: c++
 
   if (condition) {
     statement;




More information about the cfe-commits mailing list