[cfe-dev] finding function callee declarations for type/value dependent function calls

Felix Schmitt felix.schmitt at zih.tu-dresden.de
Fri Feb 10 07:24:52 PST 2012


I would like to solve the following problem using clang:
I am traversing the AST using CompilerInstance/CompilerInvocation and try to 
find function callees for function calls. This works well, as long as the 
function call is not a type- or value-dependent CallExpr, for which the callee 
resolves to an UnresolvedLookupExpr.

template<class T>
void foo(T a) {

template<class T>
void bar() {
  T a;

int main(int argc, char **argv) {

I am aware that template instantiation is neccessary to locate the correct 
callees and that this is not possible AST-parsing setup, alone.
However, could you please give me any hints on how to solve this, i.e. how to 
perform the template instantiation and resolve the instantiated templates to 
their former counterparts in the original source code?

Thanks a lot,

More information about the cfe-dev mailing list