aboutsummaryrefslogtreecommitdiff
path: root/lldb/include/lldb/Core/UniqueCStringMap.h
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/include/lldb/Core/UniqueCStringMap.h')
-rw-r--r--lldb/include/lldb/Core/UniqueCStringMap.h25
1 files changed, 19 insertions, 6 deletions
diff --git a/lldb/include/lldb/Core/UniqueCStringMap.h b/lldb/include/lldb/Core/UniqueCStringMap.h
index 9949bd45f4fa..e37027a0150a 100644
--- a/lldb/include/lldb/Core/UniqueCStringMap.h
+++ b/lldb/include/lldb/Core/UniqueCStringMap.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_UniqueCStringMap_h_
-#define liblldb_UniqueCStringMap_h_
+#ifndef LLDB_CORE_UNIQUECSTRINGMAP_H
+#define LLDB_CORE_UNIQUECSTRINGMAP_H
#include <algorithm>
#include <vector>
@@ -32,6 +32,10 @@ public:
T value;
};
+ typedef std::vector<Entry> collection;
+ typedef typename collection::iterator iterator;
+ typedef typename collection::const_iterator const_iterator;
+
// Call this function multiple times to add a bunch of entries to this map,
// then later call UniqueCStringMap<T>::Sort() before doing any searches by
// name.
@@ -175,6 +179,18 @@ public:
}
}
+ iterator begin() { return m_map.begin(); }
+ iterator end() { return m_map.end(); }
+ const_iterator begin() const { return m_map.begin(); }
+ const_iterator end() const { return m_map.end(); }
+
+ // Range-based for loop for all entries of the specified ConstString name.
+ llvm::iterator_range<const_iterator>
+ equal_range(ConstString unique_cstr) const {
+ return llvm::make_range(
+ std::equal_range(m_map.begin(), m_map.end(), unique_cstr, Compare()));
+ };
+
protected:
struct Compare {
bool operator()(const Entry &lhs, const Entry &rhs) {
@@ -196,12 +212,9 @@ protected:
return uintptr_t(lhs.GetCString()) < uintptr_t(rhs.GetCString());
}
};
- typedef std::vector<Entry> collection;
- typedef typename collection::iterator iterator;
- typedef typename collection::const_iterator const_iterator;
collection m_map;
};
} // namespace lldb_private
-#endif // liblldb_UniqueCStringMap_h_
+#endif // LLDB_CORE_UNIQUECSTRINGMAP_H