[cfe-dev] doing global unused methods analysis

Noel Grandin via cfe-dev cfe-dev at lists.llvm.org
Mon Oct 5 05:42:00 PDT 2015


Hi

I'm working on the LibreOffice team, and I'm using a clang plugin to do a fairly brute-force analysis looking for unused 
methods, using the clang compiler plugin API.

Mostly this works fairly well. I'm walking the AST and outputting every method definition I see, and every call I see.

The one shortcoming is that clang does not generate AST nodes for all implicit instantiations of templates.
For example, if I have
    template<T> class A {};
    template<T> class B {};
    class C : public A< B<int> > {};
, it will not generate AST nodes for the B<int> instantiation that occurs in the template parameter.

Is there a way to make clang do this, or am I simply barking up the wrong tree :-) ?

Thanks, Noel Grandin.




More information about the cfe-dev mailing list