Well, since the lambda is a unnameable type you can only really pass it to templates, conveniently ;)<div><br></div><div>But yeah, interprocedural would be necessary to make it very effective<br><br><div class="gmail_quote"><div dir="ltr">On Sun, May 7, 2017, 11:29 AM Lang Hames <<a href="mailto:lhames@gmail.com">lhames@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I was thinking interprocedural analysis: it works for all the STL functions (and handleErrors) because those are templates so you have the definitions. You're right though, in general you'd probably hit calls you don't have the definition for pretty quickly.</div><div dir="ltr"><div><br></div><div>- Lang.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, May 7, 2017 at 10:50 AM, 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"><div dir="ltr"><br><br><div class="gmail_quote"><span><div dir="ltr">On Sat, May 6, 2017 at 10:52 AM Lang Hames <<a href="mailto:lhames@gmail.com" target="_blank">lhames@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><span style="font-size:12.800000190734863px">I think of such lambdas as basically programmatic control flow (like an if, while, etc) - so there's no need to explicitly state which variables you'll use within this nested scope.</span></blockquote><div><span style="font-size:12.800000190734863px"><br></span></div></div><div dir="ltr"><div><span style="font-size:12.800000190734863px">Good idea.</span></div><div><span style="font-size:12.800000190734863px"><br></span></div><div><span style="font-size:12.800000190734863px">This is probably too heavyweight to do as a warning, but some sort of style-checker plugin could suggest using default capture for non-escaping lambdas and explicit capture for may-escape ones.</span></div></div></blockquote><div><br></div></span><div>Yeah, pretty tricky to do, though - for example this use case would probably fall into the "may escape" case (since it's passed to another function which might then capture it into a std::function for later use, etc). Essentially only local lambdas called directly (not used by passing to any algorithm-like functions, etc) would be "doesn't escape". (or you could conservatively assume that anywhere you don't see the lambda copied to a std::function ctor is fine? Though that might aggressively encourage default capture where it shouldn't be, etc)</div><div><br></div><div>Tricky one, I suspect,<br>- Dave</div><div><div class="m_7130194039882118435h5"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><span style="font-size:12.800000190734863px"><br></span></div><div><span style="font-size:12.800000190734863px">- Lang. </span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 24, 2017 at 9:13 AM, 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"><div dir="ltr">Generally if a lambda's only going to be used within its own scope - I'd suggest using [&]. I think of such lambdas as basically programmatic control flow (like an if, while, etc) - so there's no need to explicitly state which variables you'll use within this nested scope.</div><div class="m_7130194039882118435m_-928774296276921091m_-546978062356089666HOEnZb"><div class="m_7130194039882118435m_-928774296276921091m_-546978062356089666h5"><br><div class="gmail_quote"><div dir="ltr">On Sun, Apr 23, 2017 at 6:34 PM Lang Hames via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: lhames<br>
Date: Sun Apr 23 20:21:23 2017<br>
New Revision: 301152<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=301152&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=301152&view=rev</a><br>
Log:<br>
[Orc] Fix a warning by removing an unused lambda capture.<br>
<br>
Modified:<br>
    llvm/trunk/include/llvm/ExecutionEngine/Orc/RPCSerialization.h<br>
<br>
Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/RPCSerialization.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/RPCSerialization.h?rev=301152&r1=301151&r2=301152&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/RPCSerialization.h?rev=301152&r1=301151&r2=301152&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/RPCSerialization.h (original)<br>
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/RPCSerialization.h Sun Apr 23 20:21:23 2017<br>
@@ -378,7 +378,7 @@ public:<br>
       return serializeSeq(C, std::string());<br>
<br>
     return handleErrors(std::move(Err),<br>
-                        [&C, &Lock](const ErrorInfoBase &EIB) {<br>
+                        [&C](const ErrorInfoBase &EIB) {<br>
                           auto SI = Serializers.find(EIB.dynamicClassID());<br>
                           if (SI == Serializers.end())<br>
                             return serializeAsStringError(C, EIB);<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>
</div></div></blockquote></div><br></div>
</blockquote></div></div></div></div>
</blockquote></div><br></div>
</blockquote></div></div>