<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#ffffff">
    On 2/28/11 6:31 AM, Gabriel Rodríguez wrote:
    <blockquote
cite="mid:1372561289.61136.1298896277588.JavaMail.root@ms1b.correo.udc.es"
      type="cite">
      <style type="text/css">p { margin: 0; }</style>
      <div style="font-family: Times New Roman; font-size: 12pt; color:
        rgb(0, 0, 0);">Hi all,<br>
        <br>
        I am trying to extend a FunctionType to include new parameters.
        In particular, I want to<br>
        ensure that the main function has been declared with both argsc
        and argsv. However<br>
        there seems to be no easy way to accomplish this:
        llvm::Function::getFunctionType() returns a<br>
        a reference to a const object, while modifying only the argument
        list yields an error during verification<br>
        since the function type does not match its arguments. Is there
        any approach that I am missing or<br>
        a simple workaround to this problem?<br>
      </div>
    </blockquote>
    <br>
    If I understand correctly, you are trying to add a parameter to the
    main() function, correct?<br>
    <br>
    If so, then you can't just modify the existing main() function. 
    Instead, you have to create a new function with an empty function
    body with the new parameter and then clone the body of the old
    main() function into the new main() function.<br>
    <br>
    There is code to do that in the poolalloc project.  Check out
    <a class="moz-txt-link-freetext" href="http://llvm.org/svn/llvm-project/poolalloc/trunk">http://llvm.org/svn/llvm-project/poolalloc/trunk</a> and look for the
    code that does this in lib/PoolAllocate/PoolAllocate.cpp in the
    MakeFunctionClone() method.<br>
    <br>
    -- John T.<br>
    <br>
    <blockquote
cite="mid:1372561289.61136.1298896277588.JavaMail.root@ms1b.correo.udc.es"
      type="cite">
      <div style="font-family: Times New Roman; font-size: 12pt; color:
        rgb(0, 0, 0);"><br>
        Thanks in advance, and best regards,<br>
        Gabriel<br>
      </div>
    </blockquote>
    <br>
  </body>
</html>