1 //===- InlineInfo.cpp -------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "llvm/DebugInfo/GSYM/FileEntry.h"
11 #include "llvm/DebugInfo/GSYM/InlineInfo.h"
19 raw_ostream
&llvm::gsym::operator<<(raw_ostream
&OS
, const InlineInfo
&II
) {
23 for (auto Range
: II
.Ranges
) {
30 OS
<< " Name = " << HEX32(II
.Name
) << ", CallFile = " << II
.CallFile
31 << ", CallLine = " << II
.CallFile
<< '\n';
32 for (const auto &Child
: II
.Children
)
37 static bool getInlineStackHelper(const InlineInfo
&II
, uint64_t Addr
,
38 std::vector
<const InlineInfo
*> &InlineStack
) {
39 if (II
.Ranges
.contains(Addr
)) {
40 // If this is the top level that represents the concrete function,
41 // there will be no name and we shoud clear the inline stack. Otherwise
42 // we have found an inline call stack that we need to insert.
44 InlineStack
.insert(InlineStack
.begin(), &II
);
45 for (const auto &Child
: II
.Children
) {
46 if (::getInlineStackHelper(Child
, Addr
, InlineStack
))
49 return !InlineStack
.empty();
54 llvm::Optional
<InlineInfo::InlineArray
> InlineInfo::getInlineStack(uint64_t Addr
) const {
56 if (getInlineStackHelper(*this, Addr
, Result
))