matus-chochlik / ctcache

Cache for clang-tidy static analysis results
Boost Software License 1.0
84 stars 30 forks source link

Add support for loading compiler args when clang-tidy is invoked with -p #10

Closed timangus closed 2 years ago

timangus commented 2 years ago

ctcache works great for the case where compiler arguments are passed on the clang-tidy command line in the form clang-tidy file.cpp -- gcc -DBLAH=1 file.cpp, however it does not deal with the (relatively common, I expect) case where the -p argument is used, whereby clang-tidy sources the compiler arguments from a compile_commands.json file that was generated during compilation. This PR adds the functionality to detect when -p is used, and loads and reads from the compile commands DB as necessary.