[cfe-dev] Add a parameter to FunctionDecl

Mohammad Adil madil90 at gmail.com
Wed Nov 14 14:19:03 PST 2012


Hi,
  There is no function to get FunctionTypeLoc from a FunctionDecl. Is there
any other way to get a FunctionTypeLoc?

Regards,
Adil


On Sun, Nov 11, 2012 at 7:32 AM, Eli Friedman <eli.friedman at gmail.com>wrote:

> On Sat, Nov 10, 2012 at 3:27 PM, madil90 <madil90 at gmail.com> wrote:
> > Hi,
> >    I am using clang to create and parse an AST. I have a function in an
> > ASTVisitor called "VisitFunctionDecl" which gives me a functiondecl
> object.
> > I need to add a new parameter to this declaration in source code e.g.
> >
> > int foo()
> > {
> >
> > }
> >
> >   should be converted to
> >
> > int foo(int a)
> > {
> > }
> >
> >    I need to find the location just before the ending bracket. Is there
> any
> > way to do that?
>
> Get a FunctionTypeLoc out of the decl; that stores the relevant locations.
>
> > Also, can I ensure that the new parameter being added
> > doesn't conflict with some variable in the function?
>
> You can use a RecursiveASTVisitor or something like that to visit all
> the declarations in the function.
>
> -Eli
>



-- 
Mohammad Adil
LUMS SSE
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121115/d97f8a67/attachment.html>


More information about the cfe-dev mailing list