[cfe-dev] Rewriter: How to rewrite an empty function argument list?
Marcel Schaible via cfe-dev
cfe-dev at lists.llvm.org
Mon Jul 31 00:45:12 PDT 2017
Alex thanks for your hint.
I was playing around with getTypeLoc, but I am didn't find a way to get
the location of the opening parenthesis of a function argument list.
Maybe you have an idea?
Marcel
Am 30.07.2017 um 21:56 schrieb Alex L:
> 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 <mailto: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 <mailto:cfe-dev at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
> <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/20170731/eab84345/attachment.html>
More information about the cfe-dev
mailing list