[Lldb-commits] [lldb] [lldb][lldb-dap] Return optional from json utils (PR #129919)
Walter Erquinigo via lldb-commits
lldb-commits at lists.llvm.org
Fri Mar 7 15:12:13 PST 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(""))),
----------------
walter-erquinigo wrote:
I think that instead of `""` you should use `{}`, which would create an empty StringRef without an actual string being backed by it. That is closer to the original source code.
I don't think why `""` would break with your patch, but if there's a place that does `GetString().GetData() == nullptr`, then there would be some divergence. So I'd rather play safe.
https://github.com/llvm/llvm-project/pull/129919
More information about the lldb-commits
mailing list