653ed2082955308783377e5636b0fa2b5fff1dee
[platform/upstream/llvm.git] / clang-tools-extra / docs / clang-tidy / checks / cert-oop57-cpp.rst
1 .. title:: clang-tidy - cert-oop57-cpp
2
3 cert-oop57-cpp
4 ==============
5
6   Flags use of the `C` standard library functions ``memset``, ``memcpy`` and
7   ``memcmp`` and similar derivatives on non-trivial types.
8
9 Options
10 -------
11
12 .. option:: MemSetNames
13
14    Specify extra functions to flag that act similarly to ``memset``.
15    Specify names in a semicolon delimited list.
16    Default is an empty string.
17    The check will detect the following functions:
18    `memset`, `std::memset`.
19
20 .. option:: MemCpyNames
21
22    Specify extra functions to flag that act similarly to ``memcpy``.
23    Specify names in a semicolon delimited list.
24    Default is an empty string.
25    The check will detect the following functions:
26    `std::memcpy`, `memcpy`, `std::memmove`, `memmove`, `std::strcpy`,
27    `strcpy`, `memccpy`, `stpncpy`, `strncpy`.
28
29 .. option:: MemCmpNames
30
31    Specify extra functions to flag that act similarly to ``memcmp``.
32    Specify names in a semicolon delimited list.
33    Default is an empty string.
34    The check will detect the following functions:
35    `std::memcmp`, `memcmp`, `std::strcmp`, `strcmp`, `strncmp`.
36
37 This check corresponds to the CERT C++ Coding Standard rule
38 `OOP57-CPP. Prefer special member functions and overloaded operators to C 
39 Standard Library functions
40 <https://wiki.sei.cmu.edu/confluence/display/cplusplus/OOP57-CPP.+Prefer+special+member+functions+and+overloaded+operators+to+C+Standard+Library+functions>`_.