[cfe-dev] coverage analysis with template-heavy code

Manuel Holtgrewe manuel.holtgrewe at fu-berlin.de
Wed Feb 8 08:40:59 PST 2012

Dear all,

maybe this was asked already or is documented elsewhere. In this case, 
please point me in the right direction.

I want to compute code coverage of a C++ program. Since some time, 
llvm/clang can do this. Apparently, this functionality has moved from 
clang into clang some time back (I had an old checkout where it appeared 
to be in clang, now it appears to be in llvm).

Now, I tested this and it worked just like GCC. While this is nice for 
most people, I would like to do more. Here is where I see limitations 
with being on par with GCC:

Our library consists almost only of templates. If a template is 
instantiated, the instrumented clang output gives me branches etc. as I 
would expect. However, no code is generated for template functions and 
thus no code is generated.

I would like to programatically find such uninstantiated functions, however.

What is the best way to do so? Would it be possible/make sense to extend 
the llvm/clang instrumentation such that a dummy symbol is generated for 
each uninstantiated template function?


More information about the cfe-dev mailing list