blob: 7f864f287eade70acdbbc7b0ee4aa637f43f0f20 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
//===-- VariableList.cpp ----------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "lldb/Symbol/VariableList.h"
#include "lldb/Symbol/Block.h"
#include "lldb/Symbol/Function.h"
#include "lldb/Symbol/CompileUnit.h"
using namespace lldb;
using namespace lldb_private;
//----------------------------------------------------------------------
// VariableList constructor
//----------------------------------------------------------------------
VariableList::VariableList() :
m_variables()
{
}
//----------------------------------------------------------------------
// Destructor
//----------------------------------------------------------------------
VariableList::~VariableList()
{
}
void
VariableList::AddVariable(VariableSP &variable_sp)
{
m_variables.push_back(variable_sp);
}
void
VariableList::AddVariables(VariableList *variable_list)
{
std::copy( variable_list->m_variables.begin(), // source begin
variable_list->m_variables.end(), // source end
back_inserter(m_variables)); // destination
}
void
VariableList::Clear()
{
m_variables.clear();
}
VariableSP
VariableList::GetVariableAtIndex(uint32_t idx)
{
VariableSP variable_sp;
if (idx < m_variables.size())
variable_sp = m_variables[idx];
return variable_sp;
}
VariableSP
VariableList::FindVariable(const ConstString& name)
{
VariableSP var_sp;
iterator pos, end = m_variables.end();
for (pos = m_variables.begin(); pos != end; ++pos)
{
if ((*pos)->GetName() == name)
{
var_sp = (*pos);
break;
}
}
return var_sp;
}
size_t
VariableList::MemorySize() const
{
size_t mem_size = sizeof(VariableList);
const_iterator pos, end = m_variables.end();
for (pos = m_variables.begin(); pos != end; ++pos)
mem_size += (*pos)->MemorySize();
return mem_size;
}
size_t
VariableList::GetSize() const
{
return m_variables.size();
}
void
VariableList::Dump(Stream *s, bool show_context) const
{
// s.Printf("%.*p: ", (int)sizeof(void*) * 2, this);
// s.Indent();
// s << "VariableList\n";
const_iterator pos, end = m_variables.end();
for (pos = m_variables.begin(); pos != end; ++pos)
{
(*pos)->Dump(s, show_context);
}
}
|