Skip to content

Commit 56c5a6b

Browse files
authored
[NFC][analyzer][docs] Crosslink MallocChecker's ownership attributes (llvm#121939)
Forgot to mention these in the checker docs.
1 parent 619a5d3 commit 56c5a6b

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

clang/docs/analyzer/checkers.rst

+18
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,9 @@ cplusplus.NewDelete (C++)
476476
"""""""""""""""""""""""""
477477
Check for double-free and use-after-free problems. Traces memory managed by new/delete.
478478
479+
Custom allocation/deallocation functions can be defined using
480+
:ref:`ownership attributes<analyzer-ownership-attrs>`.
481+
479482
.. literalinclude:: checkers/newdelete_example.cpp
480483
:language: cpp
481484
@@ -485,6 +488,9 @@ cplusplus.NewDeleteLeaks (C++)
485488
""""""""""""""""""""""""""""""
486489
Check for memory leaks. Traces memory managed by new/delete.
487490
491+
Custom allocation/deallocation functions can be defined using
492+
:ref:`ownership attributes<analyzer-ownership-attrs>`.
493+
488494
.. code-block:: cpp
489495
490496
void test() {
@@ -1263,6 +1269,9 @@ You can silence this warning either by bound checking the ``size`` parameter, or
12631269
by explicitly marking the ``size`` parameter as sanitized. See the
12641270
:ref:`optin-taint-GenericTaint` checker for an example.
12651271
1272+
Custom allocation/deallocation functions can be defined using
1273+
:ref:`ownership attributes<analyzer-ownership-attrs>`.
1274+
12661275
.. code-block:: c
12671276
12681277
void vulnerable(void) {
@@ -1857,6 +1866,9 @@ unix.Malloc (C)
18571866
"""""""""""""""
18581867
Check for memory leaks, double free, and use-after-free problems. Traces memory managed by malloc()/free().
18591868
1869+
Custom allocation/deallocation functions can be defined using
1870+
:ref:`ownership attributes<analyzer-ownership-attrs>`.
1871+
18601872
.. literalinclude:: checkers/unix_malloc_example.c
18611873
:language: c
18621874
@@ -1866,6 +1878,9 @@ unix.MallocSizeof (C)
18661878
"""""""""""""""""""""
18671879
Check for dubious ``malloc`` arguments involving ``sizeof``.
18681880
1881+
Custom allocation/deallocation functions can be defined using
1882+
:ref:`ownership attributes<analyzer-ownership-attrs>`.
1883+
18691884
.. code-block:: c
18701885
18711886
void test() {
@@ -1881,6 +1896,9 @@ unix.MismatchedDeallocator (C, C++)
18811896
"""""""""""""""""""""""""""""""""""
18821897
Check for mismatched deallocators.
18831898
1899+
Custom allocation/deallocation functions can be defined using
1900+
:ref:`ownership attributes<analyzer-ownership-attrs>`.
1901+
18841902
.. literalinclude:: checkers/mismatched_deallocator_example.cpp
18851903
:language: c
18861904

clang/include/clang/Basic/AttrDocs.td

+1
Original file line numberDiff line numberDiff line change
@@ -1393,6 +1393,7 @@ def OwnershipDocs : Documentation {
13931393
let Heading = "ownership_holds, ownership_returns, ownership_takes (Clang "
13941394
"Static Analyzer)";
13951395
let Category = DocCatFunction;
1396+
let Label = "analyzer-ownership-attrs";
13961397
let Content = [{
13971398

13981399
.. note::

0 commit comments

Comments
 (0)