mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-23 05:40:09 +00:00
[analyzer] Add documentation for std::variant checker (#76501)
Add a short documentation for `StdVariantChecker`. --------- Co-authored-by: Balazs Benics <benicsbalazs@gmail.com> Co-authored-by: whisperity <whisperity@gmail.com> Co-authored-by: DonatNagyE <donat.nagy@ericsson.com>
This commit is contained in:
parent
9e439a3539
commit
1d2fab74af
@ -1072,6 +1072,7 @@ New features
|
||||
|
||||
- Added a new experimental checker ``alpha.core.StdVariant`` to detect variant
|
||||
accesses via wrong alternatives.
|
||||
`Documentation <https://clang.llvm.org/docs/analyzer/checkers.html#alpha-core-stdvariant-c>`__.
|
||||
(`#66481 <https://github.com/llvm/llvm-project/pull/66481>`_)
|
||||
|
||||
- Added a new experimental checker ``alpha.cplusplus.ArrayDelete`` to detect
|
||||
|
@ -2095,6 +2095,21 @@ This checker is a part of ``core.StackAddressEscape``, but is temporarily disabl
|
||||
// returned block
|
||||
}
|
||||
|
||||
.. _alpha-core-StdVariant:
|
||||
|
||||
alpha.core.StdVariant (C++)
|
||||
"""""""""""""""""""""""""""
|
||||
Check if a value of active type is retrieved from an ``std::variant`` instance with ``std::get``.
|
||||
In case of bad variant type access (the accessed type differs from the active type)
|
||||
a warning is emitted. Currently, this checker does not take exception handling into account.
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
void test() {
|
||||
std::variant<int, char> v = 25;
|
||||
char c = stg::get<char>(v); // warn: "int" is the active alternative
|
||||
}
|
||||
|
||||
.. _alpha-core-TestAfterDivZero:
|
||||
|
||||
alpha.core.TestAfterDivZero (C)
|
||||
|
Loading…
Reference in New Issue
Block a user