JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.
If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.
If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.
| CodeSonar® 9.2p0 | CONFIDENTIAL | CodeSecure Inc |
This tutorial illustrates the use of the CodeSonar Plug-In API functions and types for Abstract Syntax Trees.
The tutorial examples are implemented as CodeSonar plug-ins. If you have not already worked through the plug-in tutorial, we recommend that you do so now.
CodeSonar SaaS Note: If you want to use your own custom plug-ins with CodeSonar SaaS, contact CodeSecure support for assistance. The installation instructions provided in this page are not sufficient to make plug-ins available to SaaS analyses.
We have provided an annotated example plug-in that detects casts from const to non-const types, along with a small example program that exercises the plug-in. There is a version of the plug-in for each supported API language: C++, Python, and C.
You can experiment with any or all of the of the plug-ins: note that if you install more than one, every problem will be flagged multiple times.
In this section (and throughout this manual), $CSONAR indicates the CodeSonar installation directory.
To get started:
| API language | Plug-in Source File | Go on to... |
|---|---|---|
| C++ | UnsafeCast_plugin.cpp | AST API Tutorial: C++ Version |
| Python | UnsafeCast_plugin.py | AST API Tutorial: Python Version |
| C | UnsafeCast_plugin.c | AST API Tutorial: C Version |
To report problems with this documentation, please visit https://support.codesecure.com/.