LLDB mainline
VariableList.h
Go to the documentation of this file.
1//===-- VariableList.h ------------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_SYMBOL_VARIABLELIST_H
10#define LLDB_SYMBOL_VARIABLELIST_H
11
14#include "lldb/lldb-private.h"
15
16namespace lldb_private {
17
19 typedef std::vector<lldb::VariableSP> collection;
20
21public:
22 // Constructors and Destructors
23 // VariableList(const SymbolContext &symbol_context);
25 virtual ~VariableList();
26
27 void AddVariable(const lldb::VariableSP &var_sp);
28
29 bool AddVariableIfUnique(const lldb::VariableSP &var_sp);
30
31 void AddVariables(VariableList *variable_list);
32
33 void Clear();
34
35 void Dump(Stream *s, bool show_context) const;
36
37 lldb::VariableSP GetVariableAtIndex(size_t idx) const;
38
40
42 bool include_static_members = true);
43
45 lldb::ValueType value_type,
46 bool include_static_members = true);
47
48 uint32_t FindVariableIndex(const lldb::VariableSP &var_sp);
49
50 size_t AppendVariablesIfUnique(VariableList &var_list);
51
52 // Returns the actual number of unique variables that were added to the list.
53 // "total_matches" will get updated with the actually number of matches that
54 // were found regardless of whether they were unique or not to allow for
55 // error conditions when nothing is found, versus conditions where any
56 // variables that match "regex" were already in "var_list".
58 VariableList &var_list, size_t &total_matches);
59
61 bool if_unique = true);
62
63 uint32_t FindIndexForVariable(Variable *variable);
64
65 size_t MemorySize() const;
66
67 size_t GetSize() const;
68 bool Empty() const { return m_variables.empty(); }
69
70 typedef collection::iterator iterator;
71 typedef collection::const_iterator const_iterator;
72
73 iterator begin() { return m_variables.begin(); }
74 iterator end() { return m_variables.end(); }
75 const_iterator begin() const { return m_variables.begin(); }
76 const_iterator end() const { return m_variables.end(); }
77
78 llvm::ArrayRef<lldb::VariableSP> toArrayRef() {
79 return llvm::ArrayRef(m_variables);
80 }
81
82protected:
84
85private:
86 // For VariableList only
87 VariableList(const VariableList &) = delete;
88 const VariableList &operator=(const VariableList &) = delete;
89};
90
91} // namespace lldb_private
92
93#endif // LLDB_SYMBOL_VARIABLELIST_H
A uniqued constant string class.
Definition: ConstString.h:40
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
void Dump(Stream *s, bool show_context) const
bool AddVariableIfUnique(const lldb::VariableSP &var_sp)
lldb::VariableSP GetVariableAtIndex(size_t idx) const
lldb::VariableSP FindVariable(ConstString name, bool include_static_members=true)
uint32_t FindVariableIndex(const lldb::VariableSP &var_sp)
lldb::VariableSP RemoveVariableAtIndex(size_t idx)
collection::const_iterator const_iterator
Definition: VariableList.h:71
const_iterator begin() const
Definition: VariableList.h:75
uint32_t FindIndexForVariable(Variable *variable)
const_iterator end() const
Definition: VariableList.h:76
void AddVariable(const lldb::VariableSP &var_sp)
size_t AppendVariablesWithScope(lldb::ValueType type, VariableList &var_list, bool if_unique=true)
collection::iterator iterator
Definition: VariableList.h:70
void AddVariables(VariableList *variable_list)
std::vector< lldb::VariableSP > collection
Definition: VariableList.h:19
VariableList(const VariableList &)=delete
llvm::ArrayRef< lldb::VariableSP > toArrayRef()
Definition: VariableList.h:78
size_t AppendVariablesIfUnique(VariableList &var_list)
const VariableList & operator=(const VariableList &)=delete
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::Variable > VariableSP
Definition: lldb-forward.h:486