[Lldb-commits] [lldb] [lldb][lldb-dap] Add ToJSON for OptionValueEnumeration (PR #137007)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Wed Apr 23 11:01:42 PDT 2025


================
@@ -37,6 +37,16 @@ void OptionValueEnumeration::DumpValue(const ExecutionContext *exe_ctx,
   }
 }
 
+llvm::json::Value
+OptionValueEnumeration::ToJSON(const ExecutionContext *exe_ctx) {
+  for (const auto &enums : m_enumerations) {
+    if (enums.value.value == m_current_value)
+      return enums.cstring.GetStringRef();
+  }
+
+  return llvm::formatv("%", PRIu64, static_cast<uint64_t>(m_current_value));
----------------
JDevlieghere wrote:

Could this use `to_string`? 
```suggestion
  return std::to_string(m_current_value);
```

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


More information about the lldb-commits mailing list