[Lldb-commits] [lldb] [lldb-dap] Replace Get{Signed, Unsigned} with GetInteger<T> (NFC) (PR #129823)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 4 22:38:43 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());
----------------
JDevlieghere wrote:

I think it's a good idea, especially since we have code comparing against `LLDB_INVALID_LINE_NUMBER`. I'll do that in a follow-up though to keep this one NFC. 

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


More information about the lldb-commits mailing list