I recently discovered a function of the static analyzer clang ++, and it's fantastic when I looked through my code with a thin jagged comb to find hidden errors. I just uncomment this line in the Makefile:
CXXFLAGS += --analyze -Xanalyzer -analyzer-output=text
et voila, I'm in deep error checking mode.
However, one minor problem is that whenever the analyzer does not detect any problems in a particular .cpp file, no .o file is created.
Usually this will not be a big problem (I can always recompose the above line to create the actual executable), but usually when I see the analyzer warning, the first thing I want to do is try to fix the main problem and then run make again.
... which works, but since the .o files are not generated, make will begin to re-analyze all the .cpp files again from the very beginning, not just the .cpp files that I actually changed since the previous run. This means that I end up spending quite a lot of time re-checking .cpp files that haven't changed.
My question is, is there a way to get the static analyzer to output the .o file (it should not be a valid object file, just any file with an updated time stamp), so Make will know that the βcleanβ .cpp file does not need to be repeated processing? (i.e. make make work the same as with regular compilation)
source share