<div dir="ltr"><div>Thanks John. Committed the requested changes in r<span style="font-family:arial,sans-serif;font-size:13px">174919.</span><br></div><div class="gmail_extra"><br></div><div class="gmail_extra" style>Thanks to both of you for your help.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">- Lang.<br><br><div class="gmail_quote">On Mon, Feb 11, 2013 at 11:52 AM, John McCall <span dir="ltr"><<a href="mailto:rjmccall@apple.com" target="_blank">rjmccall@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 class="im">On Feb 8, 2013, at 12:21 AM, Lang Hames <<a href="mailto:lhames@gmail.com">lhames@gmail.com</a>> wrote:<br>
> Thanks very much for all the help guys. I've attached an updated patch incorporating your feedback. It also fixes a bug - I had been memcpying members with defaulted but non-trivial assignment operators.<br>
<br>
</div>+ // Get source argument for copy constructor. Returns null if not a copy<br>
+ // constructor.<br>
+ static const VarDecl* getCCSrc(const CXXConstructorDecl *CD,<br>
+ FunctionArgList &Args) {<br>
+ if (CD->isCopyOrMoveConstructor() && CD->isImplicitlyDefined())<br>
+ return Args[Args.size() - 1];<br>
+ return 0;<br>
+ }<br>
+<br>
<br>
Please name this something like getTrivialCopySource and use /// comments.<br>
<br>
void CodeGenFunction::EmitCtorPrologue(const CXXConstructorDecl *CD,<br>
@@ -770,8 +1107,15 @@<br>
<br>
InitializeVTablePointers(ClassDecl);<br>
<br>
- for (unsigned I = 0, E = MemberInitializers.size(); I != E; ++I)<br>
- EmitMemberInitializer(*this, ClassDecl, MemberInitializers[I], CD, Args);<br>
+ if (getLangOpts().getGC() == LangOptions::NonGC) {<br>
+ ConstructorMemcpyizer CM(*this, CD, Args);<br>
+ for (unsigned I = 0, E = MemberInitializers.size(); I != E; ++I)<br>
+ CM.addMemberInitializer(MemberInitializers[I]);<br>
+ CM.finish();<br>
+ } else {<br>
+ for (unsigned I = 0, E = MemberInitializers.size(); I != E; ++I)<br>
+ EmitMemberInitializer(*this, ClassDecl, MemberInitializers[I], CD, Args);<br>
+ }<br>
<br>
You shouldn't need to split out specifically on GC mode here, since you're<br>
already setting MemcpyableCtor based on that.<br>
<br>
With those changes, go ahead and commit.<br>
<span class="HOEnZb"><font color="#888888"><br>
John.<br>
</font></span></blockquote></div><br></div></div>