[cfe-dev] Getting FunctionDecl argument name as string

Nikola Smiljanic popizdeh at gmail.com
Fri Jun 20 19:57:55 PDT 2014


Have you had a look at ParmVarDecl's base classes? I think that getName()
from NamedDecl does what you want.


On Sat, Jun 21, 2014 at 10:30 AM, Sandeep K Chaudhary <
babbusandy2006 at gmail.com> wrote:

> 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.
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140621/a44f1232/attachment.html>


More information about the cfe-dev mailing list