title: Print arguments of a function using Clang AST
body: <p>I want to get the arguments passed to a function. for example, if I have the call</p>
  
  <blockquote>
    <p>printf("%d%d", i, j);</p>
  </blockquote>
  
  <p>the output should be</p>
  
  <blockquote>
    <p>%d%d<br/>i<br/>j</p>
  </blockquote>
  
  <p>I am able to get to function calls using VisitCallExpr() in RecursiveASTVisitor. Also able to get the number of arguments and the argument types. But I don't know how to get the arguments.</p>
  
  <pre><code>bool MyRecursiveASTVisitor::VisitCallExpr (clang::CallExpr *E)  
  {
      for(int i=0, j=E-&gt;getNumArgs(); i&lt;j; i++)
      {
          llvm::errs() &lt;&lt; "argType: " &lt;&lt; E-&gt;getArg(i)-&gt;getType().getAsString() &lt;&lt; "\n";
      }
      return true;
  }
  </code></pre>
  
  <p>Output:</p>
  
  <blockquote>
    <p>argType: char *<br/>argType: int<br/>argType: int</p>
  </blockquote>
  
  <p>Please help me getting the arguments.</p>