<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 3, 2015 at 5:40 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: dblaikie<br>
Date: Tue Mar  3 19:40:07 2015<br>
New Revision: 231199<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=231199&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=231199&view=rev</a><br>
Log:<br>
LLParser: Avoid copying ValIDs, the copy ctor is deprecated in C++11 due to the presence of a user-declared dtor<br></blockquote><div><br>Oh, as a bonus - ValID's dtor actually delete memory pointed to by a member of ValID, the only reason this code didn't cause double-delete due to the copy, is that the instances copied in this codepath never had a non-null pointer in this member... subtle to say the least.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Modified:<br>
    llvm/trunk/lib/AsmParser/LLParser.cpp<br>
<br>
Modified: llvm/trunk/lib/AsmParser/LLParser.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=231199&r1=231198&r2=231199&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=231199&r1=231198&r2=231199&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)<br>
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Tue Mar  3 19:40:07 2015<br>
@@ -2512,7 +2512,12 @@ bool LLParser::ParseValID(ValID &ID, Per<br>
<br>
     if (!F) {<br>
       // Make a global variable as a placeholder for this reference.<br>
-      GlobalValue *&FwdRef = ForwardRefBlockAddresses[Fn][Label];<br>
+      GlobalValue *&FwdRef =<br>
+          ForwardRefBlockAddresses.insert(std::make_pair(<br>
+                                              std::move(Fn),<br>
+                                              std::map<ValID, GlobalValue *>()))<br>
+              .first->second.insert(std::make_pair(std::move(Label), nullptr))<br>
+              .first->second;<br>
       if (!FwdRef)<br>
         FwdRef = new GlobalVariable(*M, Type::getInt8Ty(Context), false,<br>
                                     GlobalValue::InternalLinkage, nullptr, "");<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>