Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:42:53

0001 //===-- VariableList.h ------------------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLDB_SYMBOL_VARIABLELIST_H
0010 #define LLDB_SYMBOL_VARIABLELIST_H
0011 
0012 #include "lldb/Symbol/SymbolContext.h"
0013 #include "lldb/Symbol/Variable.h"
0014 #include "lldb/lldb-private.h"
0015 
0016 namespace lldb_private {
0017 
0018 class VariableList {
0019   typedef std::vector<lldb::VariableSP> collection;
0020 
0021 public:
0022   // Constructors and Destructors
0023   //  VariableList(const SymbolContext &symbol_context);
0024   VariableList();
0025   virtual ~VariableList();
0026 
0027   void AddVariable(const lldb::VariableSP &var_sp);
0028 
0029   bool AddVariableIfUnique(const lldb::VariableSP &var_sp);
0030 
0031   void AddVariables(VariableList *variable_list);
0032 
0033   void Clear();
0034 
0035   void Dump(Stream *s, bool show_context) const;
0036 
0037   lldb::VariableSP GetVariableAtIndex(size_t idx) const;
0038 
0039   lldb::VariableSP RemoveVariableAtIndex(size_t idx);
0040 
0041   lldb::VariableSP FindVariable(ConstString name,
0042                                 bool include_static_members = true);
0043 
0044   lldb::VariableSP FindVariable(ConstString name,
0045                                 lldb::ValueType value_type,
0046                                 bool include_static_members = true);
0047 
0048   uint32_t FindVariableIndex(const lldb::VariableSP &var_sp);
0049 
0050   size_t AppendVariablesIfUnique(VariableList &var_list);
0051 
0052   // Returns the actual number of unique variables that were added to the list.
0053   // "total_matches" will get updated with the actually number of matches that
0054   // were found regardless of whether they were unique or not to allow for
0055   // error conditions when nothing is found, versus conditions where any
0056   // variables that match "regex" were already in "var_list".
0057   size_t AppendVariablesIfUnique(const RegularExpression &regex,
0058                                  VariableList &var_list, size_t &total_matches);
0059 
0060   size_t AppendVariablesWithScope(lldb::ValueType type, VariableList &var_list,
0061                                   bool if_unique = true);
0062 
0063   uint32_t FindIndexForVariable(Variable *variable);
0064 
0065   size_t MemorySize() const;
0066 
0067   size_t GetSize() const;
0068   bool Empty() const { return m_variables.empty(); }
0069 
0070   typedef collection::iterator iterator;
0071   typedef collection::const_iterator const_iterator;
0072 
0073   iterator begin() { return m_variables.begin(); }
0074   iterator end() { return m_variables.end(); }
0075   const_iterator begin() const { return m_variables.begin(); }
0076   const_iterator end() const { return m_variables.end(); }
0077 
0078   llvm::ArrayRef<lldb::VariableSP> toArrayRef() {
0079     return llvm::ArrayRef(m_variables);
0080   }
0081 
0082 protected:
0083   collection m_variables;
0084 
0085 private:
0086   // For VariableList only
0087   VariableList(const VariableList &) = delete;
0088   const VariableList &operator=(const VariableList &) = delete;
0089 };
0090 
0091 } // namespace lldb_private
0092 
0093 #endif // LLDB_SYMBOL_VARIABLELIST_H