<div dir="ltr">Once you get the TypeLoc of the function, you can try casting it to function type loc using getAsAdjusted. Here's a snipped from SemaDecl that emits a warning using the location of the '(':<div><br></div><div>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,0,128)">TypeSourceInfo</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">*</span><span style="color:rgb(0,0,0)">TI</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">FD</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">getTypeSourceInfo</span><span style="color:rgb(0,0,0)">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,0,128)">TypeLoc</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">TL</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">TI</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">getTypeLoc</span><span style="color:rgb(0,0,0)">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,0,128)">FunctionTypeLoc</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">FTL</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">TL</span><span style="color:rgb(0,0,0)">.</span><span style="color:rgb(0,0,0)">getAsAdjusted</span><span style="color:rgb(0,0,0)"><</span><span style="color:rgb(128,0,128)">FunctionTypeLoc</span><span style="color:rgb(0,0,0)">>();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,0,0)">Diag</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,0)">FTL</span><span style="color:rgb(0,0,0)">.</span><span style="color:rgb(0,0,0)">getLParenLoc</span><span style="color:rgb(0,0,0)">(),</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">diag</span><span style="color:rgb(0,0,0)">::</span>warn_strict_prototypes<span style="color:rgb(0,0,0)">)</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)"><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">2</span><span style="color:rgb(0,0,0)">;</span></pre></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 31 July 2017 at 08:45, Marcel Schaible <span dir="ltr"><<a href="mailto:marcel@schaible-consulting.de" target="_blank">marcel@schaible-consulting.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <p>Alex thanks for your hint.</p>
    <p>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.</p>
    <p>Maybe you have an idea?<span class="HOEnZb"><font color="#888888"><br>
    </font></span></p><span class="HOEnZb"><font color="#888888">
    <p>Marcel<br>
    </p></font></span><div><div class="h5">
    Am 30.07.2017 um 21:56 schrieb Alex L:<br>
    <blockquote type="cite">
      <div dir="ltr">
        <div>Hi Marcel,<br>
        </div>
        <div><br>
        </div>
        <div>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)-><span style="color:rgb(0,0,0)">getTypeSource<wbr>Info-></span><span style="color:rgb(0,0,0)">getTypeLoc</span><span style="color:rgb(0,0,0)">();</span></div>
        <div class="gmail_extra"><br>
        </div>
        <div class="gmail_extra">Alex</div>
        <div class="gmail_extra"><br>
          <div class="gmail_quote">On 30 July 2017 at 16:44, Marcel
            Schaible via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi
              everyone,<br>
              <br>
              I am trying to transform function arguments. For functions
              with a at least one argument I can position the Rewriter
              on the paramdecl.<br>
              <br>
              But if the function has no arguments there is no
              paramdecl. So how can I rewrite the argument list of such
              a function?<br>
              <br>
              Example:<br>
              <br>
              int foo() { return 42; } transform into int foo(int p1) {
              return 42;);<br>
              <br>
              Thanks<br>
              <br>
              Marcel<br>
              <br>
              ______________________________<wbr>_________________<br>
              cfe-dev mailing list<br>
              <a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
              <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
            </blockquote>
          </div>
          <br>
        </div>
      </div>
    </blockquote>
    <br>
  </div></div></div>

</blockquote></div><br></div>