[Lldb-commits] [lldb] [lldb] Keep addr for Memory Modules separate (PR #199810)

via lldb-commits lldb-commits at lists.llvm.org
Wed May 27 11:48:28 PDT 2026


================
@@ -3453,6 +3453,9 @@ class CommandObjectTargetModulesList : public CommandObjectParsed {
       const char *object_name = module->GetObjectName().GetCString();
       if (object_name)
         strm.Printf("(%s)", object_name);
+      std::optional<addr_t> memory_addr = module->GetMemoryModuleAddress();
+      if (memory_addr.has_value())
----------------
jimingham wrote:

> Yeah I used the `has_value` and `value` methods because a casual reader of the .cpp file isn't going to recognize that this is an optional type when we operate on the ivar and it will look like I'm checking for a non-zero address and then the deref is going to be confusing, unless they're looking at the .h file. (I know this comment is about a place where I have a _local_ optional and it's there's no ambiguity, but I used the same style for both throughout the PR)

I wonder if that's not better dealt with by using `memory_addr_opt` or some such suffix that will immediately tell readers what this is?

https://github.com/llvm/llvm-project/pull/199810


More information about the lldb-commits mailing list