how to know if a function name is used to call or only a reference ?

say I have the codes below:

void func() {}
void test() {
func(); // function call
if (func) { // only reference the function
}
}

when I get a DeclRefExpr from RecursiveASTVisitor::VisitDeclRefExpr, and I know func is a function type, But how can i know it’s used as a normal function call, or a reference only ?

Thanks.

Look at the outer expression? You should see the DeclRefExpr inside of a CallExpr or one of the other call AST nodes for actual calls.