1 //===-- DWARFDIECollection.cpp ----------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "DWARFDIECollection.h"
11 
12 #include <algorithm>
13 
14 #include "lldb/Utility/Stream.h"
15 
16 using namespace lldb_private;
17 using namespace std;
18 
Append(const DWARFDIE & die)19 void DWARFDIECollection::Append(const DWARFDIE &die) { m_dies.push_back(die); }
20 
21 DWARFDIE
GetDIEAtIndex(uint32_t idx) const22 DWARFDIECollection::GetDIEAtIndex(uint32_t idx) const {
23   if (idx < m_dies.size())
24     return m_dies[idx];
25   return DWARFDIE();
26 }
27 
Size() const28 size_t DWARFDIECollection::Size() const { return m_dies.size(); }
29 
Dump(Stream * s,const char * title) const30 void DWARFDIECollection::Dump(Stream *s, const char *title) const {
31   if (title && title[0] != '\0')
32     s->Printf("%s\n", title);
33   for (const auto &die : m_dies)
34     s->Printf("0x%8.8x\n", die.GetOffset());
35 }
36