Coverage Report

Created: 2023-09-21 18:56

/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/include/lldb/Symbol/VariableList.h
Line
Count
Source
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
12
#include "lldb/Symbol/SymbolContext.h"
13
#include "lldb/Symbol/Variable.h"
14
#include "lldb/lldb-private.h"
15
16
namespace lldb_private {
17
18
class VariableList {
19
  typedef std::vector<lldb::VariableSP> collection;
20
21
public:
22
  // Constructors and Destructors
23
  //  VariableList(const SymbolContext &symbol_context);
24
  VariableList();
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
39
  lldb::VariableSP RemoveVariableAtIndex(size_t idx);
40
41
  lldb::VariableSP FindVariable(ConstString name,
42
                                bool include_static_members = true);
43
44
  lldb::VariableSP FindVariable(ConstString name,
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".
57
  size_t AppendVariablesIfUnique(const RegularExpression &regex,
58
                                 VariableList &var_list, size_t &total_matches);
59
60
  size_t AppendVariablesWithScope(lldb::ValueType type, VariableList &var_list,
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
100
  bool Empty() const { return m_variables.empty(); }
69
70
  typedef collection::iterator iterator;
71
  typedef collection::const_iterator const_iterator;
72
73
2.38k
  iterator begin() { return m_variables.begin(); }
74
2.38k
  iterator end() { return m_variables.end(); }
75
4
  const_iterator begin() const { return m_variables.begin(); }
76
4
  const_iterator end() const { return m_variables.end(); }
77
78
1
  llvm::ArrayRef<lldb::VariableSP> toArrayRef() {
79
1
    return llvm::ArrayRef(m_variables);
80
1
  }
81
82
protected:
83
  collection m_variables;
84
85
private:
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