Knight is a static analysis tool for C/C++ programs written in C++20 (still in development).
- cmake
- llvm/clang(>=18 is best)
- GMP (>= 6 is best)
- sqlite (>= 3.30 is best)
You can install llvm by your package manager
apt install llvm libgmp-dev libedit-dev libsqlite3-dev libcurl4-openssl-dev libgtest-dev # for Ubuntu, CentOS and Arch Linux is similar
brew install llvm gmp sqlite googletest curl # for Homebrew
or you can build llvm from source.
cd knight
chmod +x scripts/install
# scripts/install --help
scripts/install
or run step by step:
cd knight
cmake -DLLVM_BUILD_DIR=/path/to/llvm/build -B path-to-build -S .
cmake --build path-to-build -j$(nproc)
path-to-build/bin/knight-analyzer --help # for usages
path-to-build/bin/knight-cg --help # for usages
Note: Knight only support C++20, so you need to use a cpp compiler support C++20.
Use scripts/unittest
to run all unit tests.
See TROUBLESHOOTING.md for more details.
Contributions are welcome, See CONTRIBUTING.md for more details
Knight is MIT-licensed, see LICENSE for more details