Custom Plugins for clang
| Plugin | Purpose |
|---|---|
| include-path-checker-plugin | Check for (and raise an error upon) instances of paths being used in include directives (e.g. #include "../something/file.h" ) |
| ban-pp-tokens-plugin | Check for (and raise an error upon) banned tokens being found during source lexing. This means that an error will be raised for banned tokens even if they do not actually end up being used. |
| ban-token-update-plugin | Check for (and raise an error upon) banned tokens being utilised. In constast to ban-pp-tokens-plugin, banned tokens may exist within the source files so long as they are not referenced. |
git clone https://github.com/bright-tools/clang-plugins.git
cd clang-plugins
mkdir build && cd build
cmake -G "Unix Makefiles" ..
makemake testTo manually execute a plug-in, a command such as the following can be used:
clang-11 -c -fplugin=lib/libinclude-path-checker-plugin.so files.c -Xclang -plugin-arg-include-path-checkerclang-11 -fsyntax-only -fplugin=lib/libban-pp-token-usage-plugin.so files.c -Xclang -analyze -Xclang -analyzer-checker=brighttools.ban-token-usagemake
cpack