diff options
Diffstat (limited to 'source/Symbol/TypeList.cpp')
-rw-r--r-- | source/Symbol/TypeList.cpp | 73 |
1 files changed, 13 insertions, 60 deletions
diff --git a/source/Symbol/TypeList.cpp b/source/Symbol/TypeList.cpp index 8d97b2ba25cc..f181dd66463c 100644 --- a/source/Symbol/TypeList.cpp +++ b/source/Symbol/TypeList.cpp @@ -13,18 +13,6 @@ #include <vector> // Other libraries and framework includes -#include "clang/AST/ASTConsumer.h" -#include "clang/AST/ASTContext.h" -#include "clang/AST/Decl.h" -#include "clang/AST/DeclCXX.h" -#include "clang/AST/DeclGroup.h" - -#include "clang/Basic/Builtins.h" -#include "clang/Basic/IdentifierTable.h" -#include "clang/Basic/LangOptions.h" -#include "clang/Basic/SourceManager.h" -#include "clang/Basic/TargetInfo.h" - #include "llvm/Support/FormattedStream.h" #include "llvm/Support/raw_ostream.h" @@ -36,7 +24,6 @@ using namespace lldb; using namespace lldb_private; -using namespace clang; TypeList::TypeList() : m_types () @@ -55,26 +42,7 @@ TypeList::Insert (const TypeSP& type_sp) { // Just push each type on the back for now. We will worry about uniquing later if (type_sp) - m_types.insert(std::make_pair(type_sp->GetID(), type_sp)); -} - - -bool -TypeList::InsertUnique (const TypeSP& type_sp) -{ - if (type_sp) - { - user_id_t type_uid = type_sp->GetID(); - iterator pos, end = m_types.end(); - - for (pos = m_types.find(type_uid); pos != end && pos->second->GetID() == type_uid; ++pos) - { - if (pos->second.get() == type_sp.get()) - return false; - } - } - Insert (type_sp); - return true; + m_types.push_back(type_sp); } //---------------------------------------------------------------------- @@ -129,7 +97,7 @@ TypeList::GetTypeAtIndex(uint32_t idx) for (pos = m_types.begin(), end = m_types.end(); pos != end; ++pos) { if (i == 0) - return pos->second; + return *pos; --i; } return TypeSP(); @@ -140,7 +108,7 @@ TypeList::ForEach (std::function <bool(const lldb::TypeSP &type_sp)> const &call { for (auto pos = m_types.begin(), end = m_types.end(); pos != end; ++pos) { - if (!callback(pos->second)) + if (!callback(*pos)) break; } } @@ -150,32 +118,17 @@ TypeList::ForEach (std::function <bool(lldb::TypeSP &type_sp)> const &callback) { for (auto pos = m_types.begin(), end = m_types.end(); pos != end; ++pos) { - if (!callback(pos->second)) + if (!callback(*pos)) break; } } - -bool -TypeList::RemoveTypeWithUID (user_id_t uid) -{ - iterator pos = m_types.find(uid); - - if (pos != m_types.end()) - { - m_types.erase(pos); - return true; - } - return false; -} - - void TypeList::Dump(Stream *s, bool show_context) { for (iterator pos = m_types.begin(), end = m_types.end(); pos != end; ++pos) { - pos->second->Dump(s, show_context); + pos->get()->Dump(s, show_context); } } @@ -210,13 +163,13 @@ TypeList::RemoveMismatchedTypes (const std::string &type_scope, for (pos = m_types.begin(); pos != end; ++pos) { - Type* the_type = pos->second.get(); + Type* the_type = pos->get(); bool keep_match = false; TypeClass match_type_class = eTypeClassAny; if (type_class != eTypeClassAny) { - match_type_class = the_type->GetClangForwardType().GetTypeClass (); + match_type_class = the_type->GetForwardCompilerType ().GetTypeClass (); if ((match_type_class & type_class) == 0) continue; } @@ -249,9 +202,9 @@ TypeList::RemoveMismatchedTypes (const std::string &type_scope, { if (type_scope_pos >= 2) { - // Our match scope ends with the type scope we were lookikng for, + // Our match scope ends with the type scope we were looking for, // but we need to make sure what comes before the matching - // type scope is a namepace boundary in case we are trying to match: + // type scope is a namespace boundary in case we are trying to match: // type_basename = "d" // type_scope = "b::c::" // We want to match: @@ -282,7 +235,7 @@ TypeList::RemoveMismatchedTypes (const std::string &type_scope, if (keep_match) { - matching_types.insert (*pos); + matching_types.push_back(*pos); } } m_types.swap(matching_types); @@ -304,10 +257,10 @@ TypeList::RemoveMismatchedTypes (TypeClass type_class) for (pos = m_types.begin(); pos != end; ++pos) { - Type* the_type = pos->second.get(); - TypeClass match_type_class = the_type->GetClangForwardType().GetTypeClass (); + Type* the_type = pos->get(); + TypeClass match_type_class = the_type->GetForwardCompilerType ().GetTypeClass (); if (match_type_class & type_class) - matching_types.insert (*pos); + matching_types.push_back (*pos); } m_types.swap(matching_types); } |