<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 9, 2014 at 10:52 AM, Duncan P. N. Exon Smith <span dir="ltr"><<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: dexonsmith<br>
Date: Tue Dec  9 12:52:38 2014<br>
New Revision: 223806<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=223806&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=223806&view=rev</a><br>
Log:<br>
Fix a GCC build failure from r223802<br>
<br>
Modified:<br>
    llvm/trunk/lib/IR/Metadata.cpp<br>
<br>
Modified: llvm/trunk/lib/IR/Metadata.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Metadata.cpp?rev=223806&r1=223805&r2=223806&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Metadata.cpp?rev=223806&r1=223805&r2=223806&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/IR/Metadata.cpp (original)<br>
+++ llvm/trunk/lib/IR/Metadata.cpp Tue Dec  9 12:52:38 2014<br>
@@ -341,7 +341,8 @@ MDString *MDString::get(LLVMContext &Con<br>
   if (I != Store.end())<br>
     return &I->second;<br>
<br>
-  auto *Entry = StringMapEntry<MDString>::Create(Str, Store.getAllocator());<br>
+  auto *Entry =<br>
+      StringMapEntry<MDString>::Create(Str, Store.getAllocator(), MDString());<br></blockquote><div><br>Looks like this whole function could maybe be a bit simpler (& avoid the double lookup on first access, as well as the raw StringMapEntry<>::Create):<br><br>auto &IterBool = Store.insert(std::make_pair(Str, MDString()));<br>if (IterBool.second)<br>  IterBool.first->second.Entry = &*IterBool.first;<br>return &IterBool.first->second;<br><br>(I'm not even sure it's worth the conditional? Maybe the unconditional assignment is cheaper?)<br><br>(at some point I think we might be able to avoid exposing the ability to manually create/insert/etc StringMapEntries & pretend, as much as possible, that they're just a pair like a normal map)<br><br>(and I wouldn't mind if this function returned a reference instead of a pointer, but I realize that's just my own aesthetic preference and a lot of work to make the change that might not be better)<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
   bool WasInserted = Store.insert(Entry);<br>
   (void)WasInserted;<br>
   assert(WasInserted && "Expected entry to be inserted");<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>