diff options
Diffstat (limited to 'source/Symbol/Block.cpp')
-rw-r--r-- | source/Symbol/Block.cpp | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/source/Symbol/Block.cpp b/source/Symbol/Block.cpp index d0342355911c..6fe617080f96 100644 --- a/source/Symbol/Block.cpp +++ b/source/Symbol/Block.cpp @@ -1,9 +1,8 @@ //===-- Block.cpp -----------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -17,6 +16,8 @@ #include "lldb/Symbol/VariableList.h" #include "lldb/Utility/Log.h" +#include <memory> + using namespace lldb; using namespace lldb_private; @@ -211,6 +212,21 @@ Block *Block::GetInlinedParent() { return nullptr; } +Block *Block::GetContainingInlinedBlockWithCallSite( + const Declaration &find_call_site) { + Block *inlined_block = GetContainingInlinedBlock(); + + while (inlined_block) { + const auto *function_info = inlined_block->GetInlinedFunctionInfo(); + + if (function_info && + function_info->GetCallSite().FileAndLineEqual(find_call_site)) + return inlined_block; + inlined_block = inlined_block->GetInlinedParent(); + } + return nullptr; +} + bool Block::GetRangeContainingOffset(const addr_t offset, Range &range) { const Range *range_ptr = m_ranges.FindEntryThatContains(offset); if (range_ptr) { @@ -364,8 +380,8 @@ void Block::AddChild(const BlockSP &child_block_sp) { void Block::SetInlinedFunctionInfo(const char *name, const char *mangled, const Declaration *decl_ptr, const Declaration *call_decl_ptr) { - m_inlineInfoSP.reset( - new InlineFunctionInfo(name, mangled, decl_ptr, call_decl_ptr)); + m_inlineInfoSP = std::make_shared<InlineFunctionInfo>(name, mangled, decl_ptr, + call_decl_ptr); } VariableListSP Block::GetBlockVariableList(bool can_create) { |