Re: Speeding up builds with clang-tidy, clang-analyzer and iwyu
Christian Ledergerber via ccache <[email protected]> Fri, 14 Aug 2020 08:39:04 +0200
| Newsgroups | gmane.comp.compilers.ccache |
|---|---|
| Message-ID | <[email protected]> |
I have created the following issue for cmake to launch the discussion: https://gitlab.kitware.com/cmake/cmake/-/issues/21092 On 04.08.20 19:46, Joel Rosdahl wrote: > On Sun, 2 Aug 2020 at 19:49, Christian Ledergerber via ccache > <[email protected]> wrote: >> In the mean-time I have been thinking some more and what I am afraid of >> is that the result will not be correct if the flags to clang-tidy change. >> >> A typical command run by make looks like this: >> >> cd /home/dev/erx-soft/cmake-build-debug/modules/utils && ccache >> /home/dev/clion-2020.1.3/bin/cmake/linux/bin/cmake -E __run_co_compile [...] > If I interpret the example command correctly ccache is used as a > prefix to cmake? That won't have any effect; ccache can't cache the > result of cmake so it will just fall back to executing cmake with the > given arguments (and increase some statistics counter). > >> --launcher=ccache > I guess this means that cmake will execute "ccache $compiler ..." later. > >> [...] In other words: it seems like ccache could also hash the flags to >> clang-tidy. The question: does it? > No, since ccache doesn't see any clang-tidy arguments when cmake > executes "ccache $compiler ..." as mentioned above. > >> Now that I am looking at the above command line: Will this require to >> also modify the cmake binary to generate other command lines? > I have no idea, but it sounds likely. > > Here's an idea to consider: You could write the clang-tidy arguments > to a file and set CCACHE_EXTRAFILES to the file. Or just set it to > preexisting .clang-tidy files? Then the ccache results will be > invalidated when the clang-tidy arguments change. That in combination > with the hypothetical mode where ccache would exit with failure on a > cache miss would maybe enough for your initial idea. > > -- Joel