Using annotations in the C++ sources

clair’s behaviour can be modified by simple annotations to functions or classes directly in the C++ source code. These macros are simple aliases for C++ annotations, which are ignored by the C++ compiler, but picked up by clair during its analysis.

Annotation

Description

C2PY_IGNORE

Ignore the function/class.

Example

C2PY_RENAME(new_name_in_python)

Rename the function/class. Overrules the default name deduction.

Example

C2PY_WRAP_AS_METHOD

Transform a function into a method to the first argument’s class.

Example

C2PY_MODULE_INIT

Mark a function to be called when the module is imported.

Example

Note

These annotations overrule any options in the TOML file (Cf Using a TOML configuration file).