Skip to content

Commit baa19c0

Browse files
authored
[NFC][analyzer] Document optin.portability.UnixAPI (llvm#150005)
This commit provides a brief documentation for the checker optin.portability.UnixAPI. Unfortunately the name of this checker is meaninglessly vague and its functionality is very closely related to unix.Malloc, so it should be eventually "rebranded" to a more user-friendly presentation.
1 parent 0e42eaa commit baa19c0

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

clang/docs/analyzer/checkers.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,16 @@ To override this threshold to e.g. 4 bytes, use the
11031103
11041104
optin.portability.UnixAPI
11051105
"""""""""""""""""""""""""
1106-
Finds implementation-defined behavior in UNIX/Posix functions.
1106+
Reports situations where 0 is passed as the "size" argument of various
1107+
allocation functions ( ``calloc``, ``malloc``, ``realloc``, ``reallocf``,
1108+
``alloca``, ``__builtin_alloca``, ``__builtin_alloca_with_align``, ``valloc``).
1109+
1110+
Note that similar functionality is also supported by :ref:`unix-Malloc` which
1111+
reports code that *uses* memory allocated with size zero.
1112+
1113+
(The name of this checker is motivated by the fact that it was originally
1114+
introduced with the vague goal that it "Finds implementation-defined behavior
1115+
in UNIX/Posix functions.")
11071116
11081117
11091118
optin.taint

clang/include/clang/StaticAnalyzer/Checkers/Checkers.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1656,8 +1656,8 @@ def CloneChecker : Checker<"CloneChecker">,
16561656
let ParentPackage = PortabilityOptIn in {
16571657

16581658
def UnixAPIPortabilityChecker : Checker<"UnixAPI">,
1659-
HelpText<"Finds implementation-defined behavior in UNIX/Posix functions">,
1660-
Documentation<NotDocumented>;
1659+
HelpText<"Finds dynamic memory allocation with size zero">,
1660+
Documentation<HasDocumentation>;
16611661

16621662
} // end optin.portability
16631663

0 commit comments

Comments
 (0)