[cfe-dev] Getting FunctionDecl argument name as string

Sandeep K Chaudhary babbusandy2006 at gmail.com
Fri Jun 20 17:30:45 PDT 2014


Hi guys,

In a FunctionDecl with body, I want to get all the argument names and types.

I am able to get these on console by printing to llvm::errs() as following

*llvm::errs() << f->getParamDecl(i)->getOriginalType().getAsString() <<
"\n";*
*llvm::errs() << *f->getParamDecl(i)<< "\n";*

The first one is a string. However, I can not get the string for argument
name. Though, I am able to successfully print it using llvm::errs().

Can someone please help me with it? If I can write it to some file stream,
that would also work.

I looked at ParmVarDecl but I didn't find anything useful to achieve it.

-- 
Thanks and regards,
Sandeep K Chaudhary.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140620/d0607622/attachment.html>


More information about the cfe-dev mailing list