[clang-tools-extra] r258926 - [clang-tidy] Fix documentation.
Alexander Kornienko via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 27 03:37:20 PST 2016
Author: alexfh
Date: Wed Jan 27 05:37:19 2016
New Revision: 258926
URL: http://llvm.org/viewvc/llvm-project?rev=258926&view=rev
Log:
[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.
Modified:
clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-array-to-pointer-decay.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-constant-array-index.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-pointer-arithmetic.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-const-cast.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-cstyle-cast.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-reinterpret-cast.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-static-cast-downcast.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-union-access.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-vararg.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-definitions-in-headers.rst
Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-array-to-pointer-decay.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-array-to-pointer-decay.rst?rev=258926&r1=258925&r2=258926&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-array-to-pointer-decay.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-array-to-pointer-decay.rst Wed Jan 27 05:37:19 2016
@@ -5,7 +5,8 @@ cppcoreguidelines-pro-bounds-array-to-po
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.
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=258926&r1=258925&r2=258926&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 Wed Jan 27 05:37:19 2016
@@ -4,13 +4,13 @@ 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
+``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.
Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-pointer-arithmetic.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-pointer-arithmetic.rst?rev=258926&r1=258925&r2=258926&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-pointer-arithmetic.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-pointer-arithmetic.rst Wed Jan 27 05:37:19 2016
@@ -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.
Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-const-cast.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-const-cast.rst?rev=258926&r1=258925&r2=258926&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-const-cast.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-const-cast.rst Wed Jan 27 05:37:19 2016
@@ -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.
Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-cstyle-cast.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-cstyle-cast.rst?rev=258926&r1=258925&r2=258926&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-cstyle-cast.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-cstyle-cast.rst Wed Jan 27 05:37:19 2016
@@ -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.
Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-reinterpret-cast.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-reinterpret-cast.rst?rev=258926&r1=258925&r2=258926&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-reinterpret-cast.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-reinterpret-cast.rst Wed Jan 27 05:37:19 2016
@@ -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.
Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-static-cast-downcast.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-static-cast-downcast.rst?rev=258926&r1=258925&r2=258926&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-static-cast-downcast.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-static-cast-downcast.rst Wed Jan 27 05:37:19 2016
@@ -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.
Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-union-access.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-union-access.rst?rev=258926&r1=258925&r2=258926&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-union-access.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-union-access.rst Wed Jan 27 05:37:19 2016
@@ -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.
Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-vararg.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-vararg.rst?rev=258926&r1=258925&r2=258926&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-vararg.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-vararg.rst Wed Jan 27 05:37:19 2016
@@ -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
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.
Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/misc-definitions-in-headers.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/misc-definitions-in-headers.rst?rev=258926&r1=258925&r2=258926&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/misc-definitions-in-headers.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/misc-definitions-in-headers.rst Wed Jan 27 05:37:19 2016
@@ -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.
More information about the cfe-commits
mailing list