[LLVMdev] Segmentation fault while adding an addtional argument
Eli Friedman
eli.friedman at gmail.com
Tue Sep 20 17:21:59 PDT 2011
On Tue, Sep 20, 2011 at 5:05 PM, Shawn Kim <shawn.subscribe at gmail.com> wrote:
> Hi, all
>
> I am trying to write a function pass to replace a old function to a new
> function like:
> int haha(int a) { } ==> int haha(int a, char *IO) { }
>
> The below is a part of my code and generate segmentation fault. Can you help
> me to fix it?
> Thanks,
> Shawn
>
> // Since we have now created the new function, splice the body of the
> old
> // function right into the new function, leaving the old rotting hulk of
> the
> // function empty.
> NF->getBasicBlockList().splice(NF->begin(), F.getBasicBlockList());
>
> Value *Globals = NF->arg_end();
> Globals->setName("globals");
You can't dereference arg_end... you might want to read up a bit on
C++ iterators.
-Eli
More information about the llvm-dev
mailing list