11 #include "llvm/Support/FormattedStream.h"
12 #include "llvm/Support/raw_ostream.h"
22 TypeMap::TypeMap() : m_types() {}
31 m_types.insert(std::make_pair(type_sp->GetID(), type_sp));
39 for (pos =
m_types.find(type_uid);
40 pos != end && pos->second->GetID() == type_uid; ++pos) {
41 if (pos->second.get() == type_sp.get())
86 for (pos =
m_types.begin(), end =
m_types.end(); pos != end; ++pos) {
95 std::function<
bool(
const lldb::TypeSP &type_sp)>
const &callback)
const {
96 for (
auto pos =
m_types.begin(), end =
m_types.end(); pos != end; ++pos) {
97 if (!callback(pos->second))
103 std::function<
bool(lldb::TypeSP &type_sp)>
const &callback) {
104 for (
auto pos =
m_types.begin(), end =
m_types.end(); pos != end; ++pos) {
105 if (!callback(pos->second))
114 pos != end && pos->first == uid; ++pos) {
115 if (pos->second == type_sp) {
126 pos->second->Dump(s, show_context, level);
131 llvm::StringRef type_basename,
132 TypeClass type_class,
bool exact_match) {
141 for (pos =
m_types.begin(); pos != end; ++pos) {
142 Type *the_type = pos->second.get();
143 bool keep_match =
false;
144 TypeClass match_type_class = eTypeClassAny;
146 if (type_class != eTypeClassAny) {
148 if ((match_type_class & type_class) == 0)
153 if (match_type_name_const_str) {
154 const char *match_type_name = match_type_name_const_str.
GetCString();
155 llvm::StringRef match_type_scope;
156 llvm::StringRef match_type_basename;
160 if (match_type_basename == type_basename) {
161 const size_t type_scope_size = type_scope.size();
162 const size_t match_type_scope_size = match_type_scope.size();
163 if (exact_match || (type_scope_size == match_type_scope_size)) {
164 keep_match = match_type_scope == type_scope;
166 if (match_type_scope_size > type_scope_size) {
167 const size_t type_scope_pos = match_type_scope.rfind(type_scope);
168 if (type_scope_pos == match_type_scope_size - type_scope_size) {
169 if (type_scope_pos >= 2) {
180 if (match_type_scope[type_scope_pos - 1] ==
':' &&
181 match_type_scope[type_scope_pos - 2] ==
':') {
192 keep_match = type_scope.empty() && type_basename == match_type_name;
197 matching_types.insert(*pos);