]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Symbol/TypeMap.h
Import CK as of commit 0f017230ccc86929f56bf44ef2dca93d7df8076b.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Symbol / TypeMap.h
1 //===-- TypeMap.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_TypeMap_h_
11 #define liblldb_TypeMap_h_
12
13 #include "lldb/Symbol/Type.h"
14 #include "lldb/Utility/Iterable.h"
15 #include "lldb/lldb-private.h"
16 #include <functional>
17 #include <map>
18
19 namespace lldb_private {
20
21 class TypeMap {
22 public:
23   //------------------------------------------------------------------
24   // Constructors and Destructors
25   //------------------------------------------------------------------
26   TypeMap();
27
28   virtual ~TypeMap();
29
30   void Clear();
31
32   void Dump(Stream *s, bool show_context);
33
34   TypeMap FindTypes(const ConstString &name);
35
36   void Insert(const lldb::TypeSP &type);
37
38   bool Empty() const;
39
40   bool InsertUnique(const lldb::TypeSP &type);
41
42   uint32_t GetSize() const;
43
44   lldb::TypeSP GetTypeAtIndex(uint32_t idx);
45
46   typedef std::multimap<lldb::user_id_t, lldb::TypeSP> collection;
47   typedef AdaptedIterable<collection, lldb::TypeSP, map_adapter> TypeIterable;
48
49   TypeIterable Types() { return TypeIterable(m_types); }
50
51   void ForEach(
52       std::function<bool(const lldb::TypeSP &type_sp)> const &callback) const;
53
54   void ForEach(std::function<bool(lldb::TypeSP &type_sp)> const &callback);
55
56   bool Remove(const lldb::TypeSP &type_sp);
57
58   void RemoveMismatchedTypes(const char *qualified_typename, bool exact_match);
59
60   void RemoveMismatchedTypes(const std::string &type_scope,
61                              const std::string &type_basename,
62                              lldb::TypeClass type_class, bool exact_match);
63
64   void RemoveMismatchedTypes(lldb::TypeClass type_class);
65
66 private:
67   typedef collection::iterator iterator;
68   typedef collection::const_iterator const_iterator;
69
70   collection m_types;
71
72   DISALLOW_COPY_AND_ASSIGN(TypeMap);
73 };
74
75 } // namespace lldb_private
76
77 #endif // liblldb_TypeMap_h_