[Lldb-commits] [lldb] [lldb][lldb-dap] Return optional from json utils (PR #129919)

Ebuka Ezike via lldb-commits lldb-commits at lists.llvm.org
Sun Mar 9 14:48:52 PDT 2025


================
@@ -13,8 +13,8 @@
 using namespace lldb_dap;
 
 BreakpointBase::BreakpointBase(DAP &d, const llvm::json::Object &obj)
-    : dap(d), condition(std::string(GetString(obj, "condition"))),
-      hitCondition(std::string(GetString(obj, "hitCondition"))) {}
+    : dap(d), condition(std::string(GetString(obj, "condition").value_or(""))),
----------------
da-viper wrote:

I did try that before, but I doesn't work because at the position the compiler sees it as an initializer list. and `llvm::StringRef` does not have an initializer-list constructor. 

in the previous fuction 
`GetString(..... llvm::StringRef default_value = { } )` here it is treated as llvm::StringRef{} and can infer it.   



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


More information about the lldb-commits mailing list