[llvm-branch-commits] [clang-tools-extra-branch] r366710 - Merging r366687:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Jul 22 10:51:42 PDT 2019


Author: hans
Date: Mon Jul 22 10:51:42 2019
New Revision: 366710

URL: http://llvm.org/viewvc/llvm-project?rev=366710&view=rev
Log:
Merging r366687:
------------------------------------------------------------------------
r366687 | aaronballman | 2019-07-22 15:22:08 +0200 (Mon, 22 Jul 2019) | 3 lines

Update documentation for all CERT checks that correspond to a recommendation.

CERT removed their C++ secure coding recommendations from public view and so the links within that documentation are stale. This updates various pieces of documentation to make this more clear, and to help add substance where our docs deferred to CERT's wiki.
------------------------------------------------------------------------

Modified:
    clang-tools-extra/branches/release_90/   (props changed)
    clang-tools-extra/branches/release_90/docs/clang-tidy/checks/cert-dcl21-cpp.rst
    clang-tools-extra/branches/release_90/docs/clang-tidy/checks/cert-err09-cpp.rst
    clang-tools-extra/branches/release_90/docs/clang-tidy/checks/cert-oop11-cpp.rst
    clang-tools-extra/branches/release_90/docs/clang-tidy/checks/misc-throw-by-value-catch-by-reference.rst

Propchange: clang-tools-extra/branches/release_90/
------------------------------------------------------------------------------
    svn:mergeinfo = /clang-tools-extra/trunk:366687

Modified: clang-tools-extra/branches/release_90/docs/clang-tidy/checks/cert-dcl21-cpp.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/branches/release_90/docs/clang-tidy/checks/cert-dcl21-cpp.rst?rev=366710&r1=366709&r2=366710&view=diff
==============================================================================
--- clang-tools-extra/branches/release_90/docs/clang-tidy/checks/cert-dcl21-cpp.rst (original)
+++ clang-tools-extra/branches/release_90/docs/clang-tidy/checks/cert-dcl21-cpp.rst Mon Jul 22 10:51:42 2019
@@ -7,6 +7,18 @@ This check flags postfix ``operator++``
 if the return type is not a const object. This also warns if the return type
 is a reference type.
 
+The object returned by a postfix increment or decrement operator is supposed
+to be a snapshot of the object's value prior to modification. With such an
+implementation, any modifications made to the resulting object from calling
+operator++(int) would be modifying a temporary object. Thus, such an
+implementation of a postfix increment or decrement operator should instead
+return a const object, prohibiting accidental mutation of a temporary object.
+Similarly, it is unexpected for the postfix operator to return a reference to
+its previous state, and any subsequent modifications would be operating on a
+stale object.
+
 This check corresponds to the CERT C++ Coding Standard recommendation
-`DCL21-CPP. Overloaded postfix increment and decrement operators should return a const object
-<https://www.securecoding.cert.org/confluence/display/cplusplus/DCL21-CPP.+Overloaded+postfix+increment+and+decrement+operators+should+return+a+const+object>`_.
+DCL21-CPP. Overloaded postfix increment and decrement operators should return a
+const object. However, all of the CERT recommendations have been removed from
+public view, and so their justification for the behavior of this check requires
+an account on their wiki to view.
\ No newline at end of file

Modified: clang-tools-extra/branches/release_90/docs/clang-tidy/checks/cert-err09-cpp.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/branches/release_90/docs/clang-tidy/checks/cert-err09-cpp.rst?rev=366710&r1=366709&r2=366710&view=diff
==============================================================================
--- clang-tools-extra/branches/release_90/docs/clang-tidy/checks/cert-err09-cpp.rst (original)
+++ clang-tools-extra/branches/release_90/docs/clang-tidy/checks/cert-err09-cpp.rst Mon Jul 22 10:51:42 2019
@@ -8,3 +8,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>`_
 for more information.
+
+This check corresponds to the CERT C++ Coding Standard recommendation
+ERR09-CPP. Throw anonymous temporaries. However, all of the CERT recommendations
+have been removed from public view, and so their justification for the behavior
+of this check requires an account on their wiki to view.
\ No newline at end of file

Modified: clang-tools-extra/branches/release_90/docs/clang-tidy/checks/cert-oop11-cpp.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/branches/release_90/docs/clang-tidy/checks/cert-oop11-cpp.rst?rev=366710&r1=366709&r2=366710&view=diff
==============================================================================
--- clang-tools-extra/branches/release_90/docs/clang-tidy/checks/cert-oop11-cpp.rst (original)
+++ clang-tools-extra/branches/release_90/docs/clang-tidy/checks/cert-oop11-cpp.rst Mon Jul 22 10:51:42 2019
@@ -8,3 +8,9 @@ cert-oop11-cpp
 The cert-oop11-cpp check is an alias, please see
 `performance-move-constructor-init <performance-move-constructor-init.html>`_
 for more information.
+
+This check corresponds to the CERT C++ Coding Standard recommendation
+OOP11-CPP. Do not copy-initialize members or base classes from a move
+constructor. However, all of the CERT recommendations have been removed from
+public view, and so their justification for the behavior of this check requires
+an account on their wiki to view.
\ No newline at end of file

Modified: clang-tools-extra/branches/release_90/docs/clang-tidy/checks/misc-throw-by-value-catch-by-reference.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/branches/release_90/docs/clang-tidy/checks/misc-throw-by-value-catch-by-reference.rst?rev=366710&r1=366709&r2=366710&view=diff
==============================================================================
--- clang-tools-extra/branches/release_90/docs/clang-tidy/checks/misc-throw-by-value-catch-by-reference.rst (original)
+++ clang-tools-extra/branches/release_90/docs/clang-tidy/checks/misc-throw-by-value-catch-by-reference.rst Mon Jul 22 10:51:42 2019
@@ -7,7 +7,10 @@ misc-throw-by-value-catch-by-reference
 `cert-err61-cpp` redirects here as an alias for this check.
 
 Finds violations of the rule "Throw by value, catch by reference" presented for
-example in "C++ Coding Standards" by H. Sutter and A. Alexandrescu.
+example in "C++ Coding Standards" by H. Sutter and A. Alexandrescu, as well as
+the CERT C++ Coding Standard rule `ERR61-CPP. Catch exceptions by lvalue reference
+<https://wiki.sei.cmu.edu/confluence/display/cplusplus/ERR61-CPP.+Catch+exceptions+by+lvalue+reference>`_.
+
 
 Exceptions:
   * Throwing string literals will not be flagged despite being a pointer. They
@@ -28,8 +31,8 @@ Options
 
 .. option:: CheckThrowTemporaries
 
-   Triggers detection of violations of the rule `Throw anonymous temporaries
-   <https://www.securecoding.cert.org/confluence/display/cplusplus/ERR09-CPP.+Throw+anonymous+temporaries>`_.
+   Triggers detection of violations of the CERT recommendation ERR09-CPP. Throw
+   anonymous temporaries.
    Default is `1`.
 
 .. option:: WarnOnLargeObject




More information about the llvm-branch-commits mailing list