matus-chochlik / ctcache

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

Insert the clang_analyzer option before the first -D command line option #44

Closed greg-kent closed 8 months ago

greg-kent commented 8 months ago

I ran into an issue when using ccache. My compile_commands.json looks like this "command": "/usr/bin/ccache clang++ -DBOOST_PROPERTY_TREE_RAPIDXML_STATIC_POOL_SIZE=1024 -D ......" clang-tidy-cache tries to put -D__clang_analyzer option in position 1 which is before 'clang++' which causes an error, and doesn't carry on with the hash. It now puts the -D option before the first -D option, or the existing position 1 as the default.

This error was also hidden as stderr isn't logged. The hash function just returns None. I was going to create a separate PR for that, but could put it in this one if needed.

matus-chochlik commented 8 months ago

Merged, thanks for the PR