[cfe-dev] Finding all references to a function overload or type.
    Holtgrewe, Manuel 
    manuel.holtgrewe at fu-berlin.de
       
    Thu Nov 15 00:47:17 PST 2012
    
    
  
Dear all,
I would like to use the clang infrastructure (libclang, libtooling, ...) to find all references to a function overload or a type in a program. This should also work if the program has templates.
Consider the following example:
void f(int i)
{}
template <typename T>
void f(T x)
{
  X<T> y;
}
template <typename T>
struct X
{};
template <>
struct X<long>
{};
main ()
{
  f(3.0);
  f(1);
  f(1l);
  return 0;
}
For example, I would like to find all occurences of the overload "void f(int i)" (result should be the line with "f(1)" or all occurences of the specialization "X<long>" (in the line with "X<T> y" when f is called with a long value.
Is this possible with clang? If so, can anyone point me in the right direction?
Thanks,
Manuel
    
    
More information about the cfe-dev
mailing list