[lldb] const a couple of getters on MemoryRegionInfo

GetDirtyPageList was being assigned to const & in most places anyway.
If you wanted to change the list you'd make a new one and call
SetDirtyPageList.

GetPageSize is just an int so no issues being const.

Differential Revision: https://reviews.llvm.org/D125786
This commit is contained in:
David Spickett 2022-05-17 13:43:08 +00:00
parent d4cdf013c7
commit 7d8ec4dc44
2 changed files with 3 additions and 3 deletions

View File

@ -107,13 +107,13 @@ public:
/// Get the target system's VM page size in bytes.
/// \return
/// 0 is returned if this information is unavailable.
int GetPageSize() { return m_pagesize; }
int GetPageSize() const { return m_pagesize; }
/// Get a vector of target VM pages that are dirty -- that have been
/// modified -- within this memory region. This is an Optional return
/// value; it will only be available if the remote stub was able to
/// detail this.
llvm::Optional<std::vector<lldb::addr_t>> &GetDirtyPageList() {
const llvm::Optional<std::vector<lldb::addr_t>> &GetDirtyPageList() const {
return m_dirty_pages;
}

View File

@ -133,7 +133,7 @@ uint32_t SBMemoryRegionInfo::GetNumDirtyPages() {
LLDB_INSTRUMENT_VA(this);
uint32_t num_dirty_pages = 0;
llvm::Optional<std::vector<addr_t>> dirty_page_list =
const llvm::Optional<std::vector<addr_t>> &dirty_page_list =
m_opaque_up->GetDirtyPageList();
if (dirty_page_list.hasValue())
num_dirty_pages = dirty_page_list.getValue().size();