[Lldb-commits] [PATCH] D125786: [lldb] const a couple of getters on MemoryRegionInfo

David Spickett via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue May 17 06:54:45 PDT 2022

DavidSpickett created this revision.
Herald added a project: All.
DavidSpickett requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

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

GetPageSize is just an int so no issues being const.

  rG LLVM Github Monorepo



Index: lldb/source/API/SBMemoryRegionInfo.cpp
--- lldb/source/API/SBMemoryRegionInfo.cpp
+++ lldb/source/API/SBMemoryRegionInfo.cpp
@@ -133,7 +133,7 @@
   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 =
   if (dirty_page_list.hasValue())
     num_dirty_pages = dirty_page_list.getValue().size();
Index: lldb/include/lldb/Target/MemoryRegionInfo.h
--- lldb/include/lldb/Target/MemoryRegionInfo.h
+++ lldb/include/lldb/Target/MemoryRegionInfo.h
@@ -107,13 +107,13 @@
   /// 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;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125786.430041.patch
Type: text/x-patch
Size: 1418 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220517/682f45c4/attachment.bin>

More information about the lldb-commits mailing list