summaryrefslogtreecommitdiffstats
path: root/lldb/source/API/SBMemoryRegionInfoList.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/API/SBMemoryRegionInfoList.cpp')
-rw-r--r--lldb/source/API/SBMemoryRegionInfoList.cpp32
1 files changed, 24 insertions, 8 deletions
diff --git a/lldb/source/API/SBMemoryRegionInfoList.cpp b/lldb/source/API/SBMemoryRegionInfoList.cpp
index fff4044f73e..00e2965510e 100644
--- a/lldb/source/API/SBMemoryRegionInfoList.cpp
+++ b/lldb/source/API/SBMemoryRegionInfoList.cpp
@@ -32,31 +32,47 @@ public:
return *this;
}
- uint32_t GetSize() { return m_regions.size(); }
+ size_t GetSize() const { return m_regions.size(); }
- void Append(const lldb::SBMemoryRegionInfo &sb_region) {
+ void Reserve(size_t capacity) { return m_regions.reserve(capacity); }
+
+ void Append(const MemoryRegionInfo &sb_region) {
m_regions.push_back(sb_region);
}
void Append(const MemoryRegionInfoListImpl &list) {
- for (auto val : list.m_regions)
+ Reserve(GetSize() + list.GetSize());
+
+ for (const auto &val : list.m_regions)
Append(val);
}
void Clear() { m_regions.clear(); }
- bool GetMemoryRegionInfoAtIndex(uint32_t index,
- SBMemoryRegionInfo &region_info) {
+ bool GetMemoryRegionInfoAtIndex(size_t index,
+ MemoryRegionInfo &region_info) {
if (index >= GetSize())
return false;
region_info = m_regions[index];
return true;
}
+ MemoryRegionInfos &Ref() { return m_regions; }
+
+ const MemoryRegionInfos &Ref() const { return m_regions; }
+
private:
- std::vector<lldb::SBMemoryRegionInfo> m_regions;
+ MemoryRegionInfos m_regions;
};
+MemoryRegionInfos &SBMemoryRegionInfoList::ref() {
+ return m_opaque_ap->Ref();
+}
+
+const MemoryRegionInfos &SBMemoryRegionInfoList::ref() const {
+ return m_opaque_ap->Ref();
+}
+
SBMemoryRegionInfoList::SBMemoryRegionInfoList()
: m_opaque_ap(new MemoryRegionInfoListImpl()) {}
@@ -82,7 +98,7 @@ bool SBMemoryRegionInfoList::GetMemoryRegionAtIndex(
uint32_t idx, SBMemoryRegionInfo &region_info) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
- bool result = m_opaque_ap->GetMemoryRegionInfoAtIndex(idx, region_info);
+ bool result = m_opaque_ap->GetMemoryRegionInfoAtIndex(idx, region_info.ref());
if (log) {
SBStream sstr;
@@ -100,7 +116,7 @@ bool SBMemoryRegionInfoList::GetMemoryRegionAtIndex(
void SBMemoryRegionInfoList::Clear() { m_opaque_ap->Clear(); }
void SBMemoryRegionInfoList::Append(SBMemoryRegionInfo &sb_region) {
- m_opaque_ap->Append(sb_region);
+ m_opaque_ap->Append(sb_region.ref());
}
void SBMemoryRegionInfoList::Append(SBMemoryRegionInfoList &sb_region_list) {
OpenPOWER on IntegriCloud