[cfe-dev] Rewriter: How to rewrite an empty function argument list?

Alex L via cfe-dev cfe-dev at lists.llvm.org
Sun Jul 30 12:56:23 PDT 2017


Hi Marcel,

I believe that you can get the location of '('/')' and insert a new
parameter after/before that location. The locations of braces should be in
the FunctionTypeLoc which you can extract from the TypeLoc value returned
by calling ((FunctionDecl *)YourFunction)->getTypeSourceInfo->getTypeLoc();

Alex

On 30 July 2017 at 16:44, Marcel Schaible via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Hi everyone,
>
> I am trying to transform function arguments. For functions with a at least
> one argument I can position the Rewriter on the paramdecl.
>
> But if the function has no arguments there is no paramdecl. So how can I
> rewrite the argument list of such a function?
>
> Example:
>
> int foo() { return 42; } transform into int foo(int p1) { return 42;);
>
> Thanks
>
> Marcel
>
> _______________________________________________
> 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/20170730/083efda3/attachment.html>


More information about the cfe-dev mailing list