Hi,
Maybe a silly question, but why I cannot get the FunctionDecl for a given FunctionType?
Thanks,
Vassil
Because
void f();
void g();
void h();
all have the same FunctionType. Which decl do you want?
Arh... I see. Here is what I want to do:
template<typename F, typename... Args, typename... A>
F callF(F (*f)(Args...), A&&... a) {
return f(a...);
}
int f(int x) {
printf("This is f(x).\n");
return x*x;
}
int main () {
int x = 4;
callF(f, x); // Here at that point, I want to get the decl of f. That should be possible, right?
return 0;
}
Vassil
Yes. The AST should look something like this:
ExprStmt(CallExpr(..., ImplicitCastExpr(DeclRefExpr('f')), ...))
and the DeclRefExpr should have a handle to f.
Sorry for the noise I was mislead. Thanks for steering me in the right direction
Vassil