<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Nov 4, 2013 at 6:06 PM, Rafael Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">> We already reject linkonce_odr declarations, so it should fail the<br>
> verifier. Any ideas on how to assert earlier?<br>
<br>
</div>I decided to use a debugger to step over<br>
<br>
struct foo {<br>
  ~foo() {}<br>
};<br>
struct bar {<br>
  ~bar() {foo x;}<br>
};<br>
bar y;<br>
foo x;<br>
<br>
What happens is that at the end of GetOrCreateLLVMFunction we check if<br>
we have a decl defined in class and if so add it to<br>
DeferredDeclsToEmit. The net result is that we end up running<br>
replaceAllUsesWith twice when something in DeferredDeclsToEmit causes<br>
a new use of the destructor/constructor.<br>
<br>
Do you think this is OK? If not I can add a list of "DeclsToReplace"<br>
to Codegen and process that after EmitDeferred.<br></blockquote><div><br></div><div>Ah, that makes sense.  Sounds fine, if a little bit silly. </div></div></div></div>