Done both, new patch attached. <div><a href="http://codereview.appspot.com/5330046">http://codereview.appspot.com/5330046</a></div><div><br></div><div>--kcc </div><div><br><div class="gmail_quote">On Fri, Oct 28, 2011 at 10:38 PM, Chris Lattner <span dir="ltr"><<a href="mailto:clattner@apple.com">clattner@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div style="word-wrap:break-word"><div><div class="h5"><br><div><div>On Oct 28, 2011, at 1:41 PM, Kostya Serebryany wrote:</div>
<br><blockquote type="cite">Hello, <div><br></div><div>I would like to add a small utility function into llvm/Transforms/Utils.</div><div>appendToGlobalCtors() adds a function to the list of global constructors. </div><div>
Currently it is used by AddressSanitizer; clattner suggested to move it to llvm/Transforms/Utils.</div>
<div><br></div><div>Patch: <a href="http://codereview.appspot.com/5330046" target="_blank">http://codereview.appspot.com/5330046</a> (also in attachment).</div></blockquote><br></div></div></div><div>Great!  Thanks for working on this,  a few couple minor requests:</div>
<div><br></div><div><div>+//===-- GlobalCtors.h - Functions to manipulate global ctors ----*- C++ -*-===//</div><div><br></div><div>Transforms/Utils is kind of a mess, but I think it would be better to put this in a "ModuleUtils.h" file, which would be more general.  The logic in GlobalOpt.cpp for manipulating llvm.global_ctors should be moved here eventually as well.</div>
<div><br></div><div><br></div><div><div>+    GVCtor->setName("removed");</div><div>+    GVCtor->eraseFromParent();</div></div><div><br></div><div>No need for the setName call before eraseFromParent.</div><div>
<br></div><div>Otherwise, looks great!</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>-Chris</div><div><br></div><div><br></div></font></span></div><br></div></blockquote></div><br></div>