Index: clang/docs/analyzer/checkers.rst =================================================================== --- clang/docs/analyzer/checkers.rst +++ clang/docs/analyzer/checkers.rst @@ -319,13 +319,20 @@ """"""""""""""""""""""""""""" Checks std::string operations. +The current implementation is very limited. It only checks if the cstring +pointer from which the ``std::string`` object is constructed is ``NULL`` or not. +If it cannot reason about the nullness of the pointer it will assume that it +was non-null to satisfy the precondition of the constructor. + +One should never construct ``std::strings`` from ``NULL`` pointers. + .. code-block:: cpp #include 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 } }