]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Symbol/VariableList.h
Merge ^/head r337286 through r337585.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Symbol / VariableList.h
1 //===-- VariableList.h ------------------------------------------*- 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 #ifndef liblldb_VariableList_h_
11 #define liblldb_VariableList_h_
12
13 #include "lldb/Symbol/SymbolContext.h"
14 #include "lldb/Symbol/Variable.h"
15 #include "lldb/lldb-private.h"
16
17 namespace lldb_private {
18
19 class VariableList {
20 public:
21   //------------------------------------------------------------------
22   // Constructors and Destructors
23   //------------------------------------------------------------------
24   //  VariableList(const SymbolContext &symbol_context);
25   VariableList();
26   virtual ~VariableList();
27
28   void AddVariable(const lldb::VariableSP &var_sp);
29
30   bool AddVariableIfUnique(const lldb::VariableSP &var_sp);
31
32   void AddVariables(VariableList *variable_list);
33
34   void Clear();
35
36   void Dump(Stream *s, bool show_context) const;
37
38   lldb::VariableSP GetVariableAtIndex(size_t idx) const;
39
40   lldb::VariableSP RemoveVariableAtIndex(size_t idx);
41
42   lldb::VariableSP FindVariable(const ConstString &name,
43                                 bool include_static_members = true);
44
45   lldb::VariableSP FindVariable(const ConstString &name,
46                                 lldb::ValueType value_type,
47                                 bool include_static_members = true);
48
49   uint32_t FindVariableIndex(const lldb::VariableSP &var_sp);
50
51   size_t AppendVariablesIfUnique(VariableList &var_list);
52
53   // Returns the actual number of unique variables that were added to the list.
54   // "total_matches" will get updated with the actually number of matches that
55   // were found regardless of whether they were unique or not to allow for
56   // error conditions when nothing is found, versus conditions where any
57   // variables that match "regex" were already in "var_list".
58   size_t AppendVariablesIfUnique(const RegularExpression &regex,
59                                  VariableList &var_list, size_t &total_matches);
60
61   size_t AppendVariablesWithScope(lldb::ValueType type, VariableList &var_list,
62                                   bool if_unique = true);
63
64   uint32_t FindIndexForVariable(Variable *variable);
65
66   size_t MemorySize() const;
67
68   size_t GetSize() const;
69   bool Empty() const { return m_variables.empty(); }
70
71 protected:
72   typedef std::vector<lldb::VariableSP> collection;
73   typedef collection::iterator iterator;
74   typedef collection::const_iterator const_iterator;
75
76   collection m_variables;
77
78 private:
79   //------------------------------------------------------------------
80   // For VariableList only
81   //------------------------------------------------------------------
82   DISALLOW_COPY_AND_ASSIGN(VariableList);
83 };
84
85 } // namespace lldb_private
86
87 #endif // liblldb_VariableList_h_