[PATCH] D113401: [analyzer][docs] Ellaborate the docs of cplusplus.StringChecker

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 19 03:00:19 PST 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rGbf55b9f0d0e9: [analyzer][docs] Ellaborate the docs of cplusplus.StringChecker (authored by steakhal).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113401/new/

https://reviews.llvm.org/D113401

Files:
  clang/docs/analyzer/checkers.rst


Index: clang/docs/analyzer/checkers.rst
===================================================================
--- clang/docs/analyzer/checkers.rst
+++ clang/docs/analyzer/checkers.rst
@@ -319,13 +319,22 @@
 """""""""""""""""""""""""""""
 Checks std::string operations.
 
+Checks if the cstring pointer from which the ``std::string`` object is
+constructed is ``NULL`` or not.
+If the checker cannot reason about the nullness of the pointer it will assume
+that it was non-null to satisfy the precondition of the constructor.
+
+This checker is capable of checking the `SEI CERT C++ coding rule STR51-CPP.
+Do not attempt to create a std::string from a null pointer
+<https://wiki.sei.cmu.edu/confluence/x/E3s-BQ>`__.
+
 .. code-block:: cpp
 
  #include <string>
 
  void f(const char *p) {
    if (!p) {
-     std::string msg(p); // warn: p is NULL
+     std::string msg(p); // warn: The parameter must not be null
    }
  }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113401.388450.patch
Type: text/x-patch
Size: 925 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211119/db8eb9a6/attachment.bin>


More information about the cfe-commits mailing list