[Lldb-commits] [lldb] [lldb-dap] Replace Get{Signed, Unsigned} with GetInteger<T> (NFC) (PR #129823)
John Harrison via lldb-commits
lldb-commits at lists.llvm.org
Tue Mar 4 21:29:24 PST 2025
================
@@ -131,11 +131,13 @@ void BreakpointLocationsRequestHandler::operator()(
auto *arguments = request.getObject("arguments");
auto *source = arguments->getObject("source");
std::string path = GetString(source, "path").str();
- uint64_t start_line = GetUnsigned(arguments, "line", 0);
- uint64_t start_column = GetUnsigned(arguments, "column", 0);
- uint64_t end_line = GetUnsigned(arguments, "endLine", start_line);
- uint64_t end_column =
- GetUnsigned(arguments, "endColumn", std::numeric_limits<uint64_t>::max());
+ const auto start_line = GetInteger<uint64_t>(arguments, "line").value_or(0);
+ const auto start_column =
+ GetInteger<uint64_t>(arguments, "column").value_or(0);
+ const auto end_line =
+ GetInteger<uint64_t>(arguments, "endLine").value_or(start_line);
+ const auto end_column = GetInteger<uint64_t>(arguments, "endColumn")
+ .value_or(std::numeric_limits<uint64_t>::max());
----------------
ashgti wrote:
Should we use `LLDB_INVALID_LINE_NUMBER` as the default for any of the 'line' values?
And for the 'column' should default to `LLDB_INVALID_COLUMN_NUMBER`, which is also 0, but the value makes it more explicit that we're using it as a fallback.
I suppose that may result in a change of behavior, so we may not want to but it seems like some like we may want to have more specific fallbacks. For example, I haven't actually tried if I can set a breakpoint on line 0 (or 1 depending on how you count) of a file.
https://github.com/llvm/llvm-project/pull/129823
More information about the lldb-commits
mailing list