<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Sep 29, 2015, at 3:52 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><br class="Apple-interchange-newline"><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_quote" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">On Tue, Sep 29, 2015 at 1:44 PM, Adrian Prantl via cfe-commits<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank" class="">cfe-commits@lists.llvm.org</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">Author: adrian<br class="">Date: Tue Sep 29 15:44:46 2015<br class="">New Revision: 248826<br class=""><br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project?rev=248826&view=rev" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project?rev=248826&view=rev</a><br class="">Log:<br class="">CGDebugInfo: Don't reuse a reference into a DenseMap if the DenseMap may<br class="">be modified in between. (NFC)<br class=""><br class="">Modified:<br class="">   <span class="Apple-converted-space"> </span>cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br class=""><br class="">Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=248826&r1=248825&r2=248826&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=248826&r1=248825&r2=248826&view=diff</a><br class="">==============================================================================<br class="">--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)<br class="">+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Sep 29 15:44:46 2015<br class="">@@ -1680,9 +1680,9 @@ CGDebugInfo::getOrCreateModuleRef(Extern<br class="">   // nullptr if the "Module" is a PCH, which is safe because we don't<br class="">   // support chained PCH debug info, so there can only be a single PCH.<br class="">   const Module *M = Mod.getModuleOrNull();<br class="">-  auto &ModRef = ModuleCache[M];<br class="">-  if (ModRef)<br class="">-    return cast<llvm::DIModule>(ModRef);<br class="">+  auto ModRef = ModuleCache.find(M);<br class="">+  if (ModRef != ModuleCache.end())<br class="">+    return cast<llvm::DIModule>(ModRef->second);<br class=""></blockquote><div class=""><br class=""></div><div class="">Maybe change this to:<br class=""><br class="">if (const auto *Mod = ModuleCache[M])<br class="">  return cast<llvm::DIModule>(Mod);<br class=""><br class="">Or similar, to reduce variable scope, since "ModRef" isn't needed/used after this block.<br class=""><br class="">It does cause the entry to be created earlier, but that shouldn't make a difference in any real sense - but I could see a preference either way, if you prefer it the way it is, that'd be cool too.</div></div></div></blockquote><div><br class=""></div>I thought about both variants, but then decided for myself that I disliked default-creating the entry just a tiny bit more. (In this particular case it is really cheap of course).</div><div><br class=""></div><div>-- adrian<br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_quote" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class=""> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><br class="">   // Macro definitions that were defined with "-D" on the command line.<br class="">   SmallString<128> ConfigMacros;<br class="">@@ -1724,7 +1724,7 @@ CGDebugInfo::getOrCreateModuleRef(Extern<br class="">   llvm::DIModule *DIMod =<br class="">       DBuilder.createModule(Parent, Mod.getModuleName(), ConfigMacros,<br class="">                             Mod.getPath(), CGM.getHeaderSearchOpts().Sysroot);<br class="">-  ModRef.reset(DIMod);<br class="">+  ModuleCache[M].reset(DIMod);<br class="">   return DIMod;<br class=""> }<br class=""><br class=""><br class=""><br class="">_______________________________________________<br class="">cfe-commits mailing list<br class=""><a href="mailto:cfe-commits@lists.llvm.org" class="">cfe-commits@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a></blockquote></div></div></blockquote></div><br class=""></body></html>