[Lldb-commits] [lldb] r281536 - Replaced two instances of std::function with auto.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 14 14:08:05 PDT 2016


Yea, it's too bad about the type.  This is one case where auto isn't just
syntactic sugar, it's actually necessary.

On Wed, Sep 14, 2016 at 2:07 PM Sean Callanan via lldb-commits <
lldb-commits at lists.llvm.org> wrote:

> Author: spyffe
> Date: Wed Sep 14 15:58:31 2016
> New Revision: 281536
>
> URL: http://llvm.org/viewvc/llvm-project?rev=281536&view=rev
> Log:
> Replaced two instances of std::function with auto.
>
> Thanks to Zachary Turner for the suggestion.  It's distasteful that the
> actual
> type of the lambda can't be spelled out, but it should be evident from the
> definition of the lambda body.
>
> Modified:
>     lldb/trunk/source/Expression/DWARFExpression.cpp
>     lldb/trunk/source/Target/StackFrame.cpp
>
> Modified: lldb/trunk/source/Expression/DWARFExpression.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/DWARFExpression.cpp?rev=281536&r1=281535&r2=281536&view=diff
>
> ==============================================================================
> --- lldb/trunk/source/Expression/DWARFExpression.cpp (original)
> +++ lldb/trunk/source/Expression/DWARFExpression.cpp Wed Sep 14 15:58:31
> 2016
> @@ -3335,10 +3335,9 @@ bool DWARFExpression::MatchesOperand(Sta
>        return false;
>      }
>
> -    std::function<bool(const Instruction::Operand &)> recurse =
> -        [&frame, fb_expr](const Instruction::Operand &child) {
> -          return fb_expr->MatchesOperand(frame, child);
> -        };
> +    auto recurse = [&frame, fb_expr](const Instruction::Operand &child) {
> +      return fb_expr->MatchesOperand(frame, child);
> +    };
>
>      if (!offset &&
>          MatchUnaryOp(MatchOpType(Instruction::Operand::Type::Dereference),
>
> Modified: lldb/trunk/source/Target/StackFrame.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrame.cpp?rev=281536&r1=281535&r2=281536&view=diff
>
> ==============================================================================
> --- lldb/trunk/source/Target/StackFrame.cpp (original)
> +++ lldb/trunk/source/Target/StackFrame.cpp Wed Sep 14 15:58:31 2016
> @@ -1608,10 +1608,9 @@ lldb::ValueObjectSP DoGuessValueAt(Stack
>      }
>
>      Instruction::Operand *origin_operand = nullptr;
> -    std::function<bool(const Instruction::Operand &)>
> clobbered_reg_matcher =
> -        [reg_info](const Instruction::Operand &op) {
> -          return MatchRegOp(*reg_info)(op) && op.m_clobbered;
> -        };
> +    auto clobbered_reg_matcher = [reg_info](const Instruction::Operand
> &op) {
> +      return MatchRegOp(*reg_info)(op) && op.m_clobbered;
> +    };
>
>      if (clobbered_reg_matcher(operands[0])) {
>        origin_operand = &operands[1];
>
>
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160914/4b5615fe/attachment-0001.html>


More information about the lldb-commits mailing list