`GetChildMemberWithName` does not need a `ConstString`. This change makes the function take a `StringRef` instead, which alleviates the need for callers to construct a `ConstString`. I don't expect this change to improve performance, only ergonomics. This is in support of Alex's effort to replace `ConstString` where appropriate. There are related `ValueObject` functions that can also be changed, if this is accepted. Differential Revision: https://reviews.llvm.org/D151615
28 lines
887 B
C++
28 lines
887 B
C++
//===-- ClangExpressionUtil.cpp -------------------------------------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "ClangExpressionUtil.h"
|
|
|
|
#include "lldb/Core/ValueObject.h"
|
|
#include "lldb/Target/StackFrame.h"
|
|
#include "lldb/Utility/ConstString.h"
|
|
|
|
namespace lldb_private {
|
|
namespace ClangExpressionUtil {
|
|
lldb::ValueObjectSP GetLambdaValueObject(StackFrame *frame) {
|
|
assert(frame);
|
|
|
|
if (auto this_val_sp = frame->FindVariable(ConstString("this")))
|
|
if (this_val_sp->GetChildMemberWithName("this", true))
|
|
return this_val_sp;
|
|
|
|
return nullptr;
|
|
}
|
|
} // namespace ClangExpressionUtil
|
|
} // namespace lldb_private
|