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 LLDB_SYMBOL_TYPEMAP_H |
10 | #define LLDB_SYMBOL_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 | lldb::DescriptionLevel level = lldb::eDescriptionLevelFull) const; |
31 | |
32 | TypeMap FindTypes(ConstString name); |
33 | |
34 | void Insert(const lldb::TypeSP &type); |
35 | |
36 | bool Empty() const; |
37 | |
38 | bool InsertUnique(const lldb::TypeSP &type); |
39 | |
40 | uint32_t GetSize() const; |
41 | |
42 | lldb::TypeSP GetTypeAtIndex(uint32_t idx); |
43 | |
44 | lldb::TypeSP FirstType() const; |
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() const { 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(llvm::StringRef type_scope, |
59 | llvm::StringRef type_basename, |
60 | lldb::TypeClass type_class, bool exact_match); |
61 | |
62 | private: |
63 | typedef collection::iterator iterator; |
64 | typedef collection::const_iterator const_iterator; |
65 | |
66 | collection m_types; |
67 | |
68 | TypeMap(const TypeMap &) = delete; |
69 | const TypeMap &operator=(const TypeMap &) = delete; |
70 | }; |
71 | |
72 | } // namespace lldb_private |
73 | |
74 | #endif // LLDB_SYMBOL_TYPEMAP_H |
75 |