Hi, all<br><br>I am trying to write a function pass to replace a old function to a new function like:<br>int haha(int a) { } ==> int haha(int a, char *IO) { }<br><br>The below is a part of my code and generate segmentation fault. Can you help me to fix it?<br>
Thanks,<br>Shawn<br><br> // Since we have now created the new function, splice the body of the old<br> // function right into the new function, leaving the old rotting hulk of the<br> // function empty.<br> NF->getBasicBlockList().splice(NF->begin(), F.getBasicBlockList());<br>
<br> Value *Globals = NF->arg_end();<br> Globals->setName("globals");<br><br>==========================================================<br>150 Globals->setName("globals");<br>(gdb) <br>
<br>Program received signal SIGSEGV, Segmentation fault.<br>0x08591311 in llvm::StringRef::operator[] (this=0xbfffeca0, Index=0)<br> at /home/skim/Etc/LLVM/llvm/include/llvm/ADT/StringRef.h:181<br>181 return Data[Index];<br>
<br><br>