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