diff options
author | Todd Fiala <todd.fiala@gmail.com> | 2016-02-02 20:26:50 +0000 |
---|---|---|
committer | Todd Fiala <todd.fiala@gmail.com> | 2016-02-02 20:26:50 +0000 |
commit | 015b0cc2582924075ca5b6215da664477cf76fff (patch) | |
tree | 10e836c55f2e0595dd1c710734edde17e95f93d1 /lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp | |
parent | fdcb3ceb75480872eed9d83b08f3c30166fc598f (diff) | |
download | bcm5719-llvm-015b0cc2582924075ca5b6215da664477cf76fff.tar.gz bcm5719-llvm-015b0cc2582924075ca5b6215da664477cf76fff.zip |
Revert "[NFC] Cleanup RangeMap.h"
This reverts commit r259538. Caused 92 test failures on
the OS X testbot.
llvm-svn: 259556
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp')
-rw-r--r-- | lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp | 175 |
1 files changed, 0 insertions, 175 deletions
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index 61c9f20b658..c9f209e2c0f 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -107,181 +107,6 @@ struct lldb_copy_dyld_cache_local_symbols_entry uint32_t nlistCount; }; -//---------------------------------------------------------------------- -// A simple range with data class where you get to define the type of -// the range base "B", the type used for the range byte size "S", and -// the type for the associated data "T". -//---------------------------------------------------------------------- -template <typename B, typename T> -struct AddressData -{ - typedef B BaseType; - typedef T DataType; - - BaseType addr; - DataType data; - - AddressData () : - addr (), - data () - { - } - - AddressData (B a, DataType d) : - addr (a), - data (d) - { - } - - bool - operator < (const AddressData &rhs) const - { - if (this->addr == rhs.addr) - return this->data < rhs.data; - return this->addr < rhs.addr; - } - - bool - operator == (const AddressData &rhs) const - { - return this->addr == rhs.addr && - this->data == rhs.data; - } - - bool - operator != (const AddressData &rhs) const - { - return this->addr != rhs.addr || - this->data == rhs.data; - } -}; - -template <typename B, typename T, unsigned N> -class AddressDataArray -{ -public: - typedef AddressData<B,T> Entry; - typedef llvm::SmallVector<Entry, N> Collection; - - AddressDataArray() = default; - - ~AddressDataArray() = default; - - void - Append (const Entry &entry) - { - m_entries.push_back (entry); - } - - void - Sort () - { - if (m_entries.size() > 1) - std::stable_sort (m_entries.begin(), m_entries.end()); - } - -#ifdef ASSERT_RANGEMAP_ARE_SORTED - bool - IsSorted () const - { - typename Collection::const_iterator pos, end, prev; - // First we determine if we can combine any of the Entry objects so we - // don't end up allocating and making a new collection for no reason - for (pos = m_entries.begin(), end = m_entries.end(), prev = end; pos != end; prev = pos++) - { - if (prev != end && *pos < *prev) - return false; - } - return true; - } -#endif - - void - Clear () - { - m_entries.clear(); - } - - bool - IsEmpty () const - { - return m_entries.empty(); - } - - size_t - GetSize () const - { - return m_entries.size(); - } - - const Entry * - GetEntryAtIndex (size_t i) const - { - return ((i < m_entries.size()) ? &m_entries[i] : nullptr); - } - - // Clients must ensure that "i" is a valid index prior to calling this function - const Entry & - GetEntryRef (size_t i) const - { - return m_entries[i]; - } - - static bool - BaseLessThan (const Entry& lhs, const Entry& rhs) - { - return lhs.addr < rhs.addr; - } - - Entry * - FindEntry (B addr, bool exact_match_only) - { -#ifdef ASSERT_RANGEMAP_ARE_SORTED - assert (IsSorted()); -#endif - if ( !m_entries.empty() ) - { - Entry entry; - entry.addr = addr; - typename Collection::iterator begin = m_entries.begin(); - typename Collection::iterator end = m_entries.end(); - typename Collection::iterator pos = std::lower_bound (begin, end, entry, BaseLessThan); - - while(pos != begin && pos[-1].addr == addr) - --pos; - - if (pos != end) - { - if (pos->addr == addr || !exact_match_only) - return &(*pos); - } - } - return nullptr; - } - - const Entry * - FindNextEntry (const Entry *entry) - { - if (entry >= &*m_entries.begin() && entry + 1 < &*m_entries.end()) - return entry + 1; - return nullptr; - } - - Entry * - Back() - { - return (m_entries.empty() ? nullptr : &m_entries.back()); - } - - const Entry * - Back() const - { - return (m_entries.empty() ? nullptr : &m_entries.back()); - } - -protected: - Collection m_entries; -}; class RegisterContextDarwin_x86_64_Mach : public RegisterContextDarwin_x86_64 { |