[llvm] r301152 - [Orc] Fix a warning by removing an unused lambda capture.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Sat May 6 10:52:46 PDT 2017


>
> 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.


Good idea.

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.

- Lang.

On Mon, Apr 24, 2017 at 9:13 AM, David Blaikie <dblaikie at gmail.com> wrote:

> 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.
>
> On Sun, Apr 23, 2017 at 6:34 PM Lang Hames via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
>> Author: lhames
>> Date: Sun Apr 23 20:21:23 2017
>> New Revision: 301152
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=301152&view=rev
>> Log:
>> [Orc] Fix a warning by removing an unused lambda capture.
>>
>> Modified:
>>     llvm/trunk/include/llvm/ExecutionEngine/Orc/RPCSerialization.h
>>
>> Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/RPCSerialization.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/
>> llvm/ExecutionEngine/Orc/RPCSerialization.h?rev=301152&
>> r1=301151&r2=301152&view=diff
>> ============================================================
>> ==================
>> --- llvm/trunk/include/llvm/ExecutionEngine/Orc/RPCSerialization.h
>> (original)
>> +++ llvm/trunk/include/llvm/ExecutionEngine/Orc/RPCSerialization.h Sun
>> Apr 23 20:21:23 2017
>> @@ -378,7 +378,7 @@ public:
>>        return serializeSeq(C, std::string());
>>
>>      return handleErrors(std::move(Err),
>> -                        [&C, &Lock](const ErrorInfoBase &EIB) {
>> +                        [&C](const ErrorInfoBase &EIB) {
>>                            auto SI = Serializers.find(EIB.
>> dynamicClassID());
>>                            if (SI == Serializers.end())
>>                              return serializeAsStringError(C, EIB);
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170506/d6d6273d/attachment.html>


More information about the llvm-commits mailing list