[cfe-dev] determine whether a function take reference parameters

Big~Newbie via cfe-dev cfe-dev at lists.llvm.org
Mon May 22 00:21:22 PDT 2017


I want to judge whether a function take reference parameters. the sample code as "void m(int& a){}", the a is referenced! 
I use the following code to access this, but it can't, whats wrong with me?
   FunctionDecl *funDecl = callExpr->getDirectCallee();
   ParmVarDecl* decl = funDecl->getParamDecl(i);//i=0
   if(decl->getType()->isReferenceType()) {// I use this to judge parameter a is referenced, but cannt!!!
           myfile<<"---Ref type:"<<argNames[i]<<endl;
    }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170522/320d42c3/attachment.html>


More information about the cfe-dev mailing list