[clang] [NFC][analyzer][docs] Improve Annotations.rst (PR #122749)
DonĂ¡t Nagy via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 14 03:21:21 PST 2025
================
@@ -163,6 +163,42 @@ the use of preprocessor macros.
void my_assert_rtn(const char *, const char *, int, const char *) CLANG_ANALYZER_NORETURN;
+Dynamic Memory Modeling Annotations
+###################################
+
+If a project uses custom functions for dynamic memory management (that e.g. act as wrappers around ``malloc``/``free`` or ``new``/``delete`` in C++) and the analyzer cannot "see" the _definitions_ of these functions, it's possible to annotate their declarations to let the analyzer model their behavior. (Otherwise the analyzer cannot know that the opaque ``my_free()`` is basically equivalent to a standard ``free()`` call.)
+
+**This page only provides a brief list of these annotations.** For a full documentation, see the main `Attributes in Clang <../../AttributeReference.html#ownership-holds-ownership-returns-ownership-takes-clang-static-analyzer>`_ page.
----------------
NagyDonat wrote:
Thanks for the suggestion, I did not know about this feature.
https://github.com/llvm/llvm-project/pull/122749
More information about the cfe-commits
mailing list