title: Creating parameters for a function with clang
body: <p>I have source code which looks like this, </p>
  
  <pre><code>void update();
  
  void update()
  {
  }
  </code></pre>
  
  <p>Iam trying to parse this code with clang and modify the code to this.</p>
  
  <pre><code>typedef float v4sf attribute ((vector_size(16)));
  void update(v4sf&amp; v1, v4sf&amp; v2);
  
  void update(v4sf&amp; v1, v4sf&amp; v2)
  {
  }
  </code></pre>
  
  <p>I looked at the Rewriter classes of clang. In the function which i wrote as shown below, </p>
  
  <pre><code>MyRecursiveASTVisitor::VisitFunctionDecl(FunctionDecl *f) 
  </code></pre>
  
  <p>FunctionDecl has setParams() method which i could use. I would have to create params with this method. </p>
  
  <pre><code>  static ParmVarDecl *Create(ASTContext &amp;C, DeclContext *DC,
                               SourceLocation StartLoc,
                               SourceLocation IdLoc, IdentifierInfo *Id,
                               QualType T, TypeSourceInfo *TInfo,
                               StorageClass S, StorageClass SCAsWritten,
                               Expr *DefArg);
  </code></pre>
  
  <p>The first four arguments to the create function can be obtained from FunctionDecl. I am not sure what the rest of them have to be.</p>
  
  <p>How do i create types and also assign values to them in clang? The types need not be builtin and could be the like the one added(v4sf) in transformed source code. </p>
  
  <p>Is this way(using clang methods) to do transformations or can i use Rewriter.InsertText() to add the parameters?</p>