LLDB  mainline
TypeMap.h
Go to the documentation of this file.
1 //===-- TypeMap.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 liblldb_TypeMap_h_
10 #define liblldb_TypeMap_h_
11 
12 #include "lldb/Symbol/Type.h"
13 #include "lldb/Utility/Iterable.h"
14 #include "lldb/lldb-private.h"
15 #include <functional>
16 #include <map>
17 
18 namespace lldb_private {
19 
20 class TypeMap {
21 public:
22  // Constructors and Destructors
23  TypeMap();
24 
25  virtual ~TypeMap();
26 
27  void Clear();
28 
29  void Dump(Stream *s, bool show_context);
30 
32 
33  void Insert(const lldb::TypeSP &type);
34 
35  bool Empty() const;
36 
37  bool InsertUnique(const lldb::TypeSP &type);
38 
39  uint32_t GetSize() const;
40 
41  lldb::TypeSP GetTypeAtIndex(uint32_t idx);
42 
43  typedef std::multimap<lldb::user_id_t, lldb::TypeSP> collection;
45 
46  TypeIterable Types() { return TypeIterable(m_types); }
47 
48  void ForEach(
49  std::function<bool(const lldb::TypeSP &type_sp)> const &callback) const;
50 
51  void ForEach(std::function<bool(lldb::TypeSP &type_sp)> const &callback);
52 
53  bool Remove(const lldb::TypeSP &type_sp);
54 
55  void RemoveMismatchedTypes(const char *qualified_typename, bool exact_match);
56 
57  void RemoveMismatchedTypes(const std::string &type_scope,
58  const std::string &type_basename,
59  lldb::TypeClass type_class, bool exact_match);
60 
61  void RemoveMismatchedTypes(lldb::TypeClass type_class);
62 
63 private:
64  typedef collection::iterator iterator;
65  typedef collection::const_iterator const_iterator;
66 
67  collection m_types;
68 
69  DISALLOW_COPY_AND_ASSIGN(TypeMap);
70 };
71 
72 } // namespace lldb_private
73 
74 #endif // liblldb_TypeMap_h_
void RemoveMismatchedTypes(const char *qualified_typename, bool exact_match)
Definition: TypeMap.cpp:143
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
bool Remove(const lldb::TypeSP &type_sp)
Definition: TypeMap.cpp:123
void Insert(const lldb::TypeSP &type)
Definition: TypeMap.cpp:40
void Dump(Stream *s, bool show_context)
Definition: TypeMap.cpp:137
virtual ~TypeMap()
Definition: TypeMap.cpp:38
TypeIterable Types()
Definition: TypeMap.h:46
lldb::TypeSP GetTypeAtIndex(uint32_t idx)
Definition: TypeMap.cpp:96
TypeMap FindTypes(ConstString name)
bool Empty() const
Definition: TypeMap.cpp:90
std::multimap< lldb::user_id_t, lldb::TypeSP > collection
Definition: TypeMap.h:43
void ForEach(std::function< bool(const lldb::TypeSP &type_sp)> const &callback) const
Definition: TypeMap.cpp:107
bool InsertUnique(const lldb::TypeSP &type)
Definition: TypeMap.cpp:47
A uniqued constant string class.
Definition: ConstString.h:38
uint32_t GetSize() const
Definition: TypeMap.cpp:88
AdaptedIterable< collection, lldb::TypeSP, map_adapter > TypeIterable
Definition: TypeMap.h:44