DeclRefExpr: how to distinguish between variable ref and function ref?

Hi,

I am traversing C source code using ASTConsumer.
bool Visit(Stmt *S)
{


if( isa(S) )
ProcessDeclRefExpr(cast(S));


}

Whenever any variable or function is referred if condition(given in above code fragment ) evaluates to true
and it is processed by ProcessDeclRefExpr function.

I want to handle variable and functions ref differently.
How can i distinguish between variable and function ref???/

Hi,
I’d check the declaration of the DeclRefExpr
bool Visit(Stmt S)
{


if( clang::DeclRefExpr
Ref = dyn_castclang::DeclRefExpr(S) ) {
if (clang::FunctionDecl* FD = dyn_castclang::FunctionDecl(Ref->getDecl()))
ProcessFunctionDeclRef(Ref);
else if (clang::VarDecl* VD = dyn_castclang::VarDecl(Ref->getDecl()))
ProcessVariableDeclRef(Ref);
}
Cheers,
Vassil