[Lldb-commits] [lldb] [lldb/API] Add setters to SBStructuredData (PR #154445)

Alex Langford via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 21 13:56:44 PDT 2025


================
@@ -81,6 +81,40 @@ class StructuredDataImpl {
 
   void SetObjectSP(const StructuredData::ObjectSP &obj) { m_data_sp = obj; }
 
+  void SetValueForKey(llvm::StringRef key,
+                      const StructuredData::ObjectSP &value) {
+    if (m_data_sp) {
+      if (StructuredData::Dictionary *dict = m_data_sp->GetAsDictionary())
+        dict->AddItem(key, value);
+      return;
+    }
+    m_data_sp = StructuredData::FromKeyValue(key, value);
+  }
+
+  void SetUnsignedIntegerValue(uint64_t value) {
+    m_data_sp = StructuredData::FromInteger(value);
+  }
+
+  void SetSignedIntegerValue(int64_t value) {
+    m_data_sp = StructuredData::FromInteger(value);
+  }
+
+  void SetFloatValue(double value) {
+    m_data_sp = StructuredData::FromFloat(value);
+  }
+
+  void SetBooleanValue(bool value) {
+    m_data_sp = StructuredData::FromBoolean(value);
+  }
+
+  void SetStringValue(std::string value) {
+    m_data_sp = StructuredData::FromString(value);
----------------
bulbazord wrote:

Suggestion: Move here to avoid an unnecessary copy

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


More information about the lldb-commits mailing list