Clone llvm-project: https://github.com/sh-zam/llvm-project
- cd to
llvm-project
and then run cmake.
cmake -B build -G Ninja -DLLVM_ENABLE_PROJECTS="clang-tools-extra;clang" \
-DLLVM_TARGET_ARCH="x86_64" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DLLVM_TARGETS_TO_BUILD="X86" -DCMAKE_BUILD_TYPE=Release ./llvm
Note: building in Debug
mode causes SERIOUS paging issues.
- Set
PATH
or use the option in script for clang-tidy binary - Get compilation database using cmake and link it to project root.
- Run clang-tidy on project using helper script in llvm-project
Script is Located here:
llvm-project/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
~/workspace/llvm-project/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py \ -checks='-*,misc-no-key-function' -header-filter='.*'
I got lots of errors while it checked
moc_*
. I am not sure how to go about fixing them