This repository provides a collection of Clang-Tidy checks inspired by the goals and safety principles behind coding standards such as MISRA C:2023 and MISRA C:2012.
The project does not reproduce any MISRA copyright content, including rule names, rule texts, or associated documentation. All the MISRA mapping is put into a separate repository, see Clang-Tidy MISRA for more information.
To build clang-tidy Automotive, follow these steps:
Clang 20 (or compatible version)
-
Clone the repository:
git clone https://github.com/PeterHallonmark/clang-tidy-automotive.git cd clang-tidy-automotive
-
Run the following setup scripts to build Clang-Tidy Automotive:
./download.sh ./setup.sh ./configure.sh ./build.sh
Note: The scripts will need to be adjusted to use a Docker container in the future. This is part of the TODO list.
To use the Automotive support in clang-tidy, enable the rules automotive-* when using clang-tidy. The example below assumes the avoid-goto.c test file and the root directory of clang-tidy-automotive.
./build/bin/clang-tidy --checks="automotive-avoid-goto" test/checkers/automotive/statement/avoid-goto.c --
See clang-tidy for more information.
The repository follows LLVM's license structure to make it easier to upstream changes to the LLVM project if and when that happens. :)
Move setup scripts to a Docker container for easier setup and environment management.
Feel free to open issues or pull requests if you'd like to contribute to this project. Contributions are always welcome!
Note: This project is not officially associated with MISRA or LLVM. Any contributions or code changes are not officially endorsed by MISRA or LLVM.