diff options
| author | Alexander Kornienko <alexfh@google.com> | 2016-01-27 11:37:19 +0000 |
|---|---|---|
| committer | Alexander Kornienko <alexfh@google.com> | 2016-01-27 11:37:19 +0000 |
| commit | 1b290adc43edc3190b8939088bda874688ca3ed8 (patch) | |
| tree | f78e3fe7fb18393aa2349a9d42c9a48c64bb0df6 | |
| parent | e267dafc13195a1389bc9dc94cdc52eb1c36ae40 (diff) | |
| download | bcm5719-llvm-1b290adc43edc3190b8939088bda874688ca3ed8.tar.gz bcm5719-llvm-1b290adc43edc3190b8939088bda874688ca3ed8.zip | |
[clang-tidy] Fix documentation.
Fixed broken links to cppcoreguidelines (anchors specified in the .md file
should be used, not automatic anchors generated by github).
Fixed formatting, array_view -> span, fixed sphinx errors in
misc-definitions-in-headers.rst.
llvm-svn: 258926
10 files changed, 53 insertions, 35 deletions
diff --git a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-array-to-pointer-decay.rst b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-array-to-pointer-decay.rst index 48de24473e8..172df2ba92f 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-array-to-pointer-decay.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-array-to-pointer-decay.rst @@ -5,7 +5,8 @@ cppcoreguidelines-pro-bounds-array-to-pointer-decay This check flags all array to pointer decays. -Pointers should not be used as arrays. array_view is a bounds-checked, safe alternative to using pointers to access arrays. +Pointers should not be used as arrays. ``span<T>`` is a bounds-checked, safe +alternative to using pointers to access arrays. This rule is part of the "Bounds safety" profile of the C++ Core Guidelines, see -https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-bounds3-no-array-to-pointer-decay +https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Pro-bounds-decay. diff --git a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-constant-array-index.rst b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-constant-array-index.rst index 979f8af4fb1..dd20a52ac19 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-constant-array-index.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-constant-array-index.rst @@ -4,13 +4,13 @@ cppcoreguidelines-pro-bounds-constant-array-index ================================================= 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 +``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 -cppcoreguidelines-pro-bounds-constant-array-index.GslHeader has been -set to the name of the include file that contains gsl::at(), e.g. "gsl/gsl.h". +``cppcoreguidelines-pro-bounds-constant-array-index.GslHeader`` has been set to +the name of the include file that contains ``gsl::at()``, e.g. ``"gsl/gsl.h"``. This rule is part of the "Bounds safety" profile of the C++ Core Guidelines, see -https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-bounds2-only-index-into-arrays-using-constant-expressions. +https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Pro-bounds-arrayindex. diff --git a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-pointer-arithmetic.rst b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-pointer-arithmetic.rst index 870dbf87ee0..e0660df2985 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-pointer-arithmetic.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-pointer-arithmetic.rst @@ -3,10 +3,12 @@ cppcoreguidelines-pro-bounds-pointer-arithmetic =============================================== -This check flags all usage of pointer arithmetic, because it could lead to an invalid pointer. -Subtraction of two pointers is not flagged by this check. +This check flags all usage of pointer arithmetic, because it could lead to an +invalid pointer. Subtraction of two pointers is not flagged by this check. -Pointers should only refer to single objects, and pointer arithmetic is fragile and easy to get wrong. array_view is a bounds-checked, safe type for accessing arrays of data. +Pointers should only refer to single objects, and pointer arithmetic is fragile +and easy to get wrong. ``span<T>`` is a bounds-checked, safe type for accessing +arrays of data. This rule is part of the "Bounds safety" profile of the C++ Core Guidelines, see -https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-bounds1-dont-use-pointer-arithmetic-use-array_view-instead +https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Pro-bounds-arithmetic. diff --git a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-type-const-cast.rst b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-type-const-cast.rst index a5a38406461..f3f0fb4a5d4 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-type-const-cast.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-type-const-cast.rst @@ -3,9 +3,10 @@ cppcoreguidelines-pro-type-const-cast ===================================== -This check flags all uses of const_cast in C++ code. +This check flags all uses of ``const_cast`` in C++ code. -Modifying a variable that was declared const is undefined behavior, even with const_cast. +Modifying a variable that was declared const is undefined behavior, even with +``const_cast``. This rule is part of the "Type safety" profile of the C++ Core Guidelines, see -https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-type3-dont-use-const_cast-to-cast-away-const-ie-at-all. +https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Pro-type-constcast. diff --git a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-type-cstyle-cast.rst b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-type-cstyle-cast.rst index 55ae1bc5925..31ba7867b50 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-type-cstyle-cast.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-type-cstyle-cast.rst @@ -3,15 +3,16 @@ cppcoreguidelines-pro-type-cstyle-cast ====================================== -This check flags all use of C-style casts that perform a static_cast downcast, const_cast, or reinterpret_cast. +This check flags all use of C-style casts that perform a ``static_cast`` +downcast, ``const_cast``, or ``reinterpret_cast``. Use of these casts can violate type safety and cause the program to access a -variable that is actually of type X to be accessed as if it were of an -unrelated type Z. Note that a C-style (T)expression cast means to perform -the first of the following that is possible: a const_cast, a static_cast, a -static_cast followed by a const_cast, a reinterpret_cast, or a -reinterpret_cast followed by a const_cast. This rule bans (T)expression -only when used to perform an unsafe cast. +variable that is actually of type X to be accessed as if it were of an unrelated +type Z. Note that a C-style ``(T)expression`` cast means to perform the first of +the following that is possible: a ``const_cast``, a ``static_cast``, a +``static_cast`` followed by a ``const_cast``, a ``reinterpret_cast``, or a +``reinterpret_cast`` followed by a ``const_cast``. This rule bans +``(T)expression`` only when used to perform an unsafe cast. This rule is part of the "Type safety" profile of the C++ Core Guidelines, see -https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-type4-dont-use-c-style-texpression-casts-that-would-perform-a-static_cast-downcast-const_cast-or-reinterpret_cast. +https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Pro-type-cstylecast. diff --git a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-type-reinterpret-cast.rst b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-type-reinterpret-cast.rst index 4254fb9e2a4..2ef76f25825 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-type-reinterpret-cast.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-type-reinterpret-cast.rst @@ -3,9 +3,11 @@ cppcoreguidelines-pro-type-reinterpret-cast =========================================== -This check flags all uses of reinterpret_cast in C++ code. +This check flags all uses of ``reinterpret_cast`` in C++ code. -Use of these casts can violate type safety and cause the program to access a variable that is actually of type X to be accessed as if it were of an unrelated type Z. +Use of these casts can violate type safety and cause the program to access a +variable that is actually of type ``X`` to be accessed as if it were of an +unrelated type ``Z``. This rule is part of the "Type safety" profile of the C++ Core Guidelines, see -https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-type1-dont-use-reinterpret_cast. +https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Pro-type-reinterpretcast. diff --git a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-type-static-cast-downcast.rst b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-type-static-cast-downcast.rst index ceb66c20c55..1d29af51a27 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-type-static-cast-downcast.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-type-static-cast-downcast.rst @@ -3,10 +3,13 @@ cppcoreguidelines-pro-type-static-cast-downcast =============================================== -This check flags all usages of static_cast, where a base class is casted to a derived class. -In those cases, a fixit is provided to convert the cast to a dynamic_cast. +This check flags all usages of ``static_cast``, where a base class is casted to +a derived class. In those cases, a fixit is provided to convert the cast to a +``dynamic_cast``. -Use of these casts can violate type safety and cause the program to access a variable that is actually of type X to be accessed as if it were of an unrelated type Z. +Use of these casts can violate type safety and cause the program to access a +variable that is actually of type ``X`` to be accessed as if it were of an +unrelated type ``Z``. This rule is part of the "Type safety" profile of the C++ Core Guidelines, see -https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-type2-dont-use-static_cast-downcasts-use-dynamic_cast-instead +https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Pro-type-downcast. diff --git a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-type-union-access.rst b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-type-union-access.rst index 0f40ff202d7..cdcf713816c 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-type-union-access.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-type-union-access.rst @@ -3,9 +3,14 @@ cppcoreguidelines-pro-type-union-access ======================================= -This check flags all access to members of unions. Passing unions as a whole is not flagged. +This check flags all access to members of unions. Passing unions as a whole is +not flagged. -Reading from a union member assumes that member was the last one written, and writing to a union member assumes another member with a nontrivial destructor had its destructor called. This is fragile because it cannot generally be enforced to be safe in the language and so relies on programmer discipline to get it right. +Reading from a union member assumes that member was the last one written, and +writing to a union member assumes another member with a nontrivial destructor +had its destructor called. This is fragile because it cannot generally be +enforced to be safe in the language and so relies on programmer discipline to +get it right. This rule is part of the "Type safety" profile of the C++ Core Guidelines, see -https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-type7-avoid-accessing-members-of-raw-unions-prefer-variant-instead +https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Pro-type-unions. diff --git a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-type-vararg.rst b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-type-vararg.rst index 22b14ace531..26fcd0c6390 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-type-vararg.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-type-vararg.rst @@ -3,7 +3,8 @@ cppcoreguidelines-pro-type-vararg ================================= -This check flags all calls to c-style vararg functions and all use of va_arg. +This check flags all calls to c-style vararg functions and all use of +``va_arg``. To allow for SFINAE use of vararg functions, a call is not flagged if a literal 0 is passed as the only vararg argument. @@ -13,4 +14,4 @@ because it cannot generally be enforced to be safe in the language and so relies on programmer discipline to get it right. This rule is part of the "Type safety" profile of the C++ Core Guidelines, see -https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-type8-avoid-reading-from-varargs-or-passing-vararg-arguments-prefer-variadic-template-parameters-instead +https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Pro-type-varargs. diff --git a/clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst b/clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst index c7bf3131d54..dae2cc9ecf6 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst @@ -1,9 +1,11 @@ misc-definitions-in-headers =========================== -Finds non-extern non-inline function and variable definitions in header files, which can lead to potential ODR violations. +Finds non-extern non-inline function and variable definitions in header files, +which can lead to potential ODR violations. .. code:: c++ + // Foo.h int a = 1; // Warning. extern int d; // OK: extern variable. |

