xref: /openbsd-src/gnu/llvm/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionUtil.cpp (revision f6aab3d83b51b91c24247ad2c2573574de475a82)
1*f6aab3d8Srobert //===-- ClangExpressionUtil.cpp -------------------------------------------===//
2*f6aab3d8Srobert //
3*f6aab3d8Srobert // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*f6aab3d8Srobert // See https://llvm.org/LICENSE.txt for license information.
5*f6aab3d8Srobert // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*f6aab3d8Srobert //
7*f6aab3d8Srobert //===----------------------------------------------------------------------===//
8*f6aab3d8Srobert 
9*f6aab3d8Srobert #include "ClangExpressionUtil.h"
10*f6aab3d8Srobert 
11*f6aab3d8Srobert #include "lldb/Core/ValueObject.h"
12*f6aab3d8Srobert #include "lldb/Target/StackFrame.h"
13*f6aab3d8Srobert #include "lldb/Utility/ConstString.h"
14*f6aab3d8Srobert 
15*f6aab3d8Srobert namespace lldb_private {
16*f6aab3d8Srobert namespace ClangExpressionUtil {
GetLambdaValueObject(StackFrame * frame)17*f6aab3d8Srobert lldb::ValueObjectSP GetLambdaValueObject(StackFrame *frame) {
18*f6aab3d8Srobert   assert(frame);
19*f6aab3d8Srobert 
20*f6aab3d8Srobert   if (auto this_val_sp = frame->FindVariable(ConstString("this")))
21*f6aab3d8Srobert     if (this_val_sp->GetChildMemberWithName(ConstString("this"), true))
22*f6aab3d8Srobert       return this_val_sp;
23*f6aab3d8Srobert 
24*f6aab3d8Srobert   return nullptr;
25*f6aab3d8Srobert }
26*f6aab3d8Srobert } // namespace ClangExpressionUtil
27*f6aab3d8Srobert } // namespace lldb_private
28