[clang] [clang][analyzer doc] Add basic description of checker 'core.CallAndMessage' (NFC). (PR #177179)
Balázs Kéri via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 23 02:26:29 PST 2026
https://github.com/balazske updated https://github.com/llvm/llvm-project/pull/177179
>From 982a6b1aafaf6eb5e644a4e02710e73d5447957a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?= <balazs.keri at ericsson.com>
Date: Wed, 21 Jan 2026 15:16:58 +0100
Subject: [PATCH 1/2] [clang][analyzer doc] Add basic description of checker
'core.CallAndMessage' (NFC).
The checker had very little documentation. Now a more detailed (but still
not much) description of the features and options is added.
---
clang/docs/analyzer/checkers.rst | 43 +++++++++++++++++++++++++++++++-
1 file changed, 42 insertions(+), 1 deletion(-)
diff --git a/clang/docs/analyzer/checkers.rst b/clang/docs/analyzer/checkers.rst
index 31edf9e99dc7d..ae9c1dea14d55 100644
--- a/clang/docs/analyzer/checkers.rst
+++ b/clang/docs/analyzer/checkers.rst
@@ -83,7 +83,48 @@ Ensure the shift operands are in proper range before shifting.
core.CallAndMessage (C, C++, ObjC)
""""""""""""""""""""""""""""""""""
- Check for logical errors for function calls and Objective-C message expressions (e.g., uninitialized arguments, null function pointers).
+Check for logical errors for function calls and Objective-C message expressions
+(e.g., uninitialized arguments, null function pointers).
+
+This checker is a collection of related checks that can be turned on or off by
+checker options.
+
+* **FunctionPointer** Check for null or undefined function pointer at function
+ call.
+* **CXXThisMethodCall** Check for null or undefined ``this`` pointer at method
+ call.
+* **CXXDeallocationArg** Check for null or undefined argument of
+ ``operator delete``.
+* **ArgInitializedness** Check for undefined pass-by-value function arguments.
+* **ArgPointeeInitializedness** Check for undefined pass-by-reference (pointer
+ to constant value or constant reference) function arguments. In special cases
+ non-constant arguments are checked. This happens for C library functions where
+ it is required to initialize (at least partially) a passed structure which
+ is used for both input and output (for example last argument of ``mktime`` or
+ ``mbrlen``).
+* **ParameterCount** Check for correct number of passed arguments to functions
+ or ObjC blocks. This will warn if the actual argument count is less than the
+ required count (by the declaration).
+* **NilReceiver** Check whether the receiver in a message expression is ``nil``.
+* **UndefReceiver** Check whether the receiver in a message expression is
+ undefined.
+
+For example to turn off the check for parameter count, set the checker option
+``ParameterCount`` to ``false``. By default all of these checks is enabled
+except **ArgPointeeInitializedness** because this check is more likely to
+produce false positives.
+
+**Additional options**
+
+* **ArgPointeeInitializednessComplete** Controls when to emit the warning at the
+ **ArgPointeeInitializedness** check. If set to ``true`` the warning will be
+ emitted if any member of the passed structure is not initialized. If set to
+ ``false`` the warning is emitted only if all members (the complete structure)
+ are not initialized. The default is ``false``. (Arguments of C library
+ functions which require initialization are always checked as if the option
+ would be ``false``.)
+
+**Some examples**
.. literalinclude:: checkers/callandmessage_example.c
:language: objc
>From 82b4aef6cf8e7e72a126280ffe6b1cfb378ef054 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?= <balazs.keri at ericsson.com>
Date: Fri, 23 Jan 2026 11:26:00 +0100
Subject: [PATCH 2/2] reorganized documentation
---
clang/docs/analyzer/checkers.rst | 41 ++++++++++++++++----------------
1 file changed, 21 insertions(+), 20 deletions(-)
diff --git a/clang/docs/analyzer/checkers.rst b/clang/docs/analyzer/checkers.rst
index ae9c1dea14d55..c55e2c0a81c07 100644
--- a/clang/docs/analyzer/checkers.rst
+++ b/clang/docs/analyzer/checkers.rst
@@ -86,8 +86,9 @@ core.CallAndMessage (C, C++, ObjC)
Check for logical errors for function calls and Objective-C message expressions
(e.g., uninitialized arguments, null function pointers).
-This checker is a collection of related checks that can be turned on or off by
-checker options.
+This checker is a collection of related checks that are controlled by checker
+options. The following checks are all enabled by default, but can be turned off
+by setting their option to ``false``:
* **FunctionPointer** Check for null or undefined function pointer at function
call.
@@ -96,33 +97,33 @@ checker options.
* **CXXDeallocationArg** Check for null or undefined argument of
``operator delete``.
* **ArgInitializedness** Check for undefined pass-by-value function arguments.
-* **ArgPointeeInitializedness** Check for undefined pass-by-reference (pointer
- to constant value or constant reference) function arguments. In special cases
- non-constant arguments are checked. This happens for C library functions where
- it is required to initialize (at least partially) a passed structure which
- is used for both input and output (for example last argument of ``mktime`` or
- ``mbrlen``).
* **ParameterCount** Check for correct number of passed arguments to functions
or ObjC blocks. This will warn if the actual argument count is less than the
required count (by the declaration).
-* **NilReceiver** Check whether the receiver in a message expression is ``nil``.
+* **NilReceiver** Check whether the receiver in a message expression is
+ ``nil``.
* **UndefReceiver** Check whether the receiver in a message expression is
undefined.
-For example to turn off the check for parameter count, set the checker option
-``ParameterCount`` to ``false``. By default all of these checks is enabled
-except **ArgPointeeInitializedness** because this check is more likely to
-produce false positives.
+The following check is disabled by default (because it is more likely to
+produce false positives), this can be turned on by set the option to ``true``:
+
+* **ArgPointeeInitializedness** Check for undefined pass-by-reference (pointer
+ to constant value or constant reference) function arguments. In special cases
+ non-constant arguments are checked. This happens for C library functions
+ where it is required to initialize (at least partially) a passed structure
+ which is used for both input and output (for example last argument of
+ ``mktime`` or ``mbrlen``).
**Additional options**
-* **ArgPointeeInitializednessComplete** Controls when to emit the warning at the
- **ArgPointeeInitializedness** check. If set to ``true`` the warning will be
- emitted if any member of the passed structure is not initialized. If set to
- ``false`` the warning is emitted only if all members (the complete structure)
- are not initialized. The default is ``false``. (Arguments of C library
- functions which require initialization are always checked as if the option
- would be ``false``.)
+* **ArgPointeeInitializednessComplete** Controls when to emit the warning at
+ the **ArgPointeeInitializedness** check. If this option is ``false`` (the
+ default), a ``struct`` is considered to be "initialized" when at least one
+ member is initialized. When this option is set to ``true``, structures are
+ only accepted as initialized when all members are initialized. (Arguments of
+ C library functions which require initialization are always checked as if the
+ option would be ``false``.)
**Some examples**
More information about the cfe-commits
mailing list