diff options
Diffstat (limited to 'clang/docs/analyzer')
-rw-r--r-- | clang/docs/analyzer/checkers.rst | 11 | ||||
-rw-r--r-- | clang/docs/analyzer/checkers/unix_malloc_example.c | 2 | ||||
-rw-r--r-- | clang/docs/analyzer/user-docs/CrossTranslationUnit.rst | 4 |
3 files changed, 13 insertions, 4 deletions
diff --git a/clang/docs/analyzer/checkers.rst b/clang/docs/analyzer/checkers.rst index 26c5028..4e8b318 100644 --- a/clang/docs/analyzer/checkers.rst +++ b/clang/docs/analyzer/checkers.rst @@ -1103,7 +1103,16 @@ To override this threshold to e.g. 4 bytes, use the optin.portability.UnixAPI """"""""""""""""""""""""" -Finds implementation-defined behavior in UNIX/Posix functions. +Reports situations where 0 is passed as the "size" argument of various +allocation functions ( ``calloc``, ``malloc``, ``realloc``, ``reallocf``, +``alloca``, ``__builtin_alloca``, ``__builtin_alloca_with_align``, ``valloc``). + +Note that similar functionality is also supported by :ref:`unix-Malloc` which +reports code that *uses* memory allocated with size zero. + +(The name of this checker is motivated by the fact that it was originally +introduced with the vague goal that it "Finds implementation-defined behavior +in UNIX/Posix functions.") optin.taint diff --git a/clang/docs/analyzer/checkers/unix_malloc_example.c b/clang/docs/analyzer/checkers/unix_malloc_example.c index 68c5a4a..30df074 100644 --- a/clang/docs/analyzer/checkers/unix_malloc_example.c +++ b/clang/docs/analyzer/checkers/unix_malloc_example.c @@ -2,7 +2,7 @@ void test() { int *p = malloc(1); free(p); - free(p); // warn: attempt to free released memory + free(p); // warn: attempt to release already released memory } void test() { diff --git a/clang/docs/analyzer/user-docs/CrossTranslationUnit.rst b/clang/docs/analyzer/user-docs/CrossTranslationUnit.rst index 700dac0..a04b9f8 100644 --- a/clang/docs/analyzer/user-docs/CrossTranslationUnit.rst +++ b/clang/docs/analyzer/user-docs/CrossTranslationUnit.rst @@ -132,7 +132,7 @@ Once we have set up the `PATH` environment variable and we activated the python .. code-block:: bash - $ CodeChecker analyze --ctu compile_commands.json -o reports + $ CodeChecker analyze --ctu --ctu-ast-mode load-from-pch compile_commands.json -o reports $ ls -F compile_commands.json foo.cpp foo.cpp.ast main.cpp reports/ $ tree reports @@ -318,7 +318,7 @@ Once we have set up the `PATH` environment variable and we activated the python .. code-block:: bash - $ CodeChecker analyze --ctu --ctu-ast-loading-mode on-demand compile_commands.json -o reports + $ CodeChecker analyze --ctu compile_commands.json -o reports $ ls -F compile_commands.json foo.cpp main.cpp reports/ $ tree reports |