<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 24, 2015 at 11:39 AM, Yaron Keren <span dir="ltr"><<a href="mailto:yaron.keren@gmail.com" target="_blank">yaron.keren@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 dir="rtl"><div dir="ltr">Hi,<br><br>Should the [=] capture be replaced here with [&] ?<br></div></div></blockquote><div><br></div><div>That would be my preference/notion - as I was saying on another review, I think it's probably best to default to [&] for any locally scoped lambda (I feel more sure about this for a lambda only used within the full expression where it is defined (ie: in standard algorithm usage), but even probably the right idea for a lambda declared in a lexical scope and only used there - not escaped via std::function or similar)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="rtl"><div dir="ltr">The original reasoning was it's more efficient to capture DeclModule by value rather than by reference.</div></div></blockquote><div><br>Yeah, I figured that was the likely logic - I'd be inclined to just rely on the optimizers to fix this where useful/necessary & keep a simpler rule of thumb for the usage.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="rtl"><div dir="ltr"><span class="HOEnZb"><font color="#888888"><br>Yaron</font></span><div><div class="h5"><br><br><br>---------- Forwarded message ----------<br>From: Yaron Keren via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>><br>Date: 2015-11-23 21:28 GMT+02:00<br>Subject: r253904 - Replace loop with std::any_of, NFC.<br>To: ‫<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>‬<br><br>Author: yrnkrn<br>Date: Mon Nov 23 13:28:42 2015<br>New Revision: 253904<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=253904&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=253904&view=rev</a><br>Log:<br>Replace loop with std::any_of, NFC.<br>Inspired by similar commits from Craig Topper.<br><br><br>Modified:<br>    cfe/trunk/lib/Sema/SemaLookup.cpp<br><br>Modified: cfe/trunk/lib/Sema/SemaLookup.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=253904&r1=253903&r2=253904&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=253904&r1=253903&r2=253904&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)<br>+++ cfe/trunk/lib/Sema/SemaLookup.cpp Mon Nov 23 13:28:42 2015<br>@@ -1535,12 +1535,8 @@ bool LookupResult::isVisibleSlow(Sema &S<br><br>   // Check whether DeclModule is transitively exported to an import of<br>   // the lookup set.<br>-  for (llvm::DenseSet<Module *>::iterator I = LookupModules.begin(),<br>-                                          E = LookupModules.end();<br>-       I != E; ++I)<br>-    if ((*I)->isModuleVisible(DeclModule))<br>-      return true;<br>-  return false;<br>+  return std::any_of(LookupModules.begin(), LookupModules.end(),<br>+                     [=](Module *M) { return M->isModuleVisible(DeclModule); });<br> }<br><br> bool Sema::isVisibleSlow(const NamedDecl *D) {<br><br><br>_______________________________________________<br>cfe-commits mailing list<br><a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br></div></div></div></div>
</blockquote></div><br></div></div>