<div dir="ltr"><div>I am wondering what the best approach would be to generate a wrapper</div><div>function for functions with a particular attribute. I.e.,</div><div><br></div><div>When the compiler sees</div><div><br></div><div>__attribute__ ((wrapthis)) int foo(args) {}</div><div><br></div><div>I want to generate foo as usual and also generate a function</div><div><br></div><div>int</div><div>foo_wrapper(args)</div><div>{</div><div><span style="white-space:pre"> </span>// do some stuff here</div><div><span style="white-space:pre"> </span>int result = foo(args);</div><div><span style="white-space:pre"> </span>// do some more stuff here</div><div><span style="white-space:pre"> </span>return result;</div><div>}</div><div><br></div><div>I am not sure where to generate the wrapper function, e.g., in clang,</div><div>in llvm? And, what pass could I look at that might provide me with</div><div>some hints about how to go about this. Any help would be appreciated.</div><div><br></div><div>Thanks,</div><div><br></div><div>seth</div><div><br></div><div><br></div><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><br></div><div>--------------</div><div>Seth Copen Goldstein</div><div>Carnegie Mellon University</div><div>Computer Science Dept</div><div>7111 GHC</div><div>412-268-3828</div></div></div></div></div></div>
</div>