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/Core/Stream.h"
15 
16 using namespace lldb_private;
17 using namespace std;
18 
19 void
20 DWARFDIECollection::Append (const DWARFDIE &die)
21 {
22     m_dies.push_back (die);
23 }
24 
25 DWARFDIE
26 DWARFDIECollection::GetDIEAtIndex(uint32_t idx) const
27 {
28     if (idx < m_dies.size())
29         return m_dies[idx];
30     return DWARFDIE();
31 }
32 
33 
34 size_t
35 DWARFDIECollection::Size() const
36 {
37     return m_dies.size();
38 }
39 
40 void
41 DWARFDIECollection::Dump(Stream *s, const char* title) const
42 {
43     if (title && title[0] != '\0')
44         s->Printf( "%s\n", title);
45     for (const auto &die : m_dies)
46         s->Printf( "0x%8.8x\n", die.GetOffset());
47 }
48