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

mats petersson via cfe-dev cfe-dev at lists.llvm.org
Wed May 24 01:55:41 PDT 2017


Do you mean "is referenced" (in other words, is used) or "is a reference"
(in other words "may modify the original value in the caller function")?

On 22 May 2017 at 08:21, Big~Newbie via cfe-dev <cfe-dev at lists.llvm.org>
wrote:

> 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;**    }*
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170524/24f85300/attachment.html>


More information about the cfe-dev mailing list