[Lldb-commits] [lldb] [lldb-dap] Support inspecting memory (PR #104317)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 14 23:18:46 PDT 2024


================
@@ -1253,6 +1274,10 @@ llvm::json::Value CreateVariable(lldb::SBValue v, int64_t variablesReference,
   else
     object.try_emplace("variablesReference", (int64_t)0);
 
+  if (lldb::addr_t addr = GetMemoryReference(v); addr != LLDB_INVALID_ADDRESS) {
+    object.try_emplace("memoryReference", "0x" + llvm::utohexstr(addr));
+  }
----------------
clayborg wrote:

remove {} from single line `if` statments, per llvm coding guidelines https://llvm.org/docs/CodingStandards.html

And we can now use the std::optional to clean this up:
```
if (std::optional<addr_t> addr = GetMemoryReference(v)) 
  object.try_emplace("memoryReference", "0x" + llvm::utohexstr(*addr));
```

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


More information about the lldb-commits mailing list