[Lldb-commits] [lldb] b5e70d0 - [lldb-dap] Use LLDB_INVALID_LINE_NUMBER & LLDB_INVALID_COLUMN_NUMBER (#129948)

via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 5 16:19:39 PST 2025


Author: Jonas Devlieghere
Date: 2025-03-05T16:19:36-08:00
New Revision: b5e70d06827189cc701b4b02213549cee60c5160

URL: https://github.com/llvm/llvm-project/commit/b5e70d06827189cc701b4b02213549cee60c5160
DIFF: https://github.com/llvm/llvm-project/commit/b5e70d06827189cc701b4b02213549cee60c5160.diff

LOG: [lldb-dap] Use LLDB_INVALID_LINE_NUMBER & LLDB_INVALID_COLUMN_NUMBER (#129948)

Consistently use LLDB_INVALID_LINE_NUMBER & LLDB_INVALID_COLUMN_NUMBER
when parsing line and column numbers respectively.

Added: 
    

Modified: 
    lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp
    lldb/tools/lldb-dap/SourceBreakpoint.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp b/lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp
index 468dacfe6737e..d6efd659ae8e0 100644
--- a/lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp
@@ -131,9 +131,10 @@ void BreakpointLocationsRequestHandler::operator()(
   auto *arguments = request.getObject("arguments");
   auto *source = arguments->getObject("source");
   std::string path = GetString(source, "path").str();
-  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 start_line = GetInteger<uint64_t>(arguments, "line")
+                              .value_or(LLDB_INVALID_LINE_NUMBER);
+  const auto start_column = GetInteger<uint64_t>(arguments, "column")
+                                .value_or(LLDB_INVALID_COLUMN_NUMBER);
   const auto end_line =
       GetInteger<uint64_t>(arguments, "endLine").value_or(start_line);
   const auto end_column = GetInteger<uint64_t>(arguments, "endColumn")

diff  --git a/lldb/tools/lldb-dap/SourceBreakpoint.cpp b/lldb/tools/lldb-dap/SourceBreakpoint.cpp
index 37341fa387d40..7742dce2928b5 100644
--- a/lldb/tools/lldb-dap/SourceBreakpoint.cpp
+++ b/lldb/tools/lldb-dap/SourceBreakpoint.cpp
@@ -27,8 +27,10 @@ namespace lldb_dap {
 SourceBreakpoint::SourceBreakpoint(DAP &dap, const llvm::json::Object &obj)
     : Breakpoint(dap, obj),
       logMessage(std::string(GetString(obj, "logMessage"))),
-      line(GetInteger<uint64_t>(obj, "line").value_or(0)),
-      column(GetInteger<uint64_t>(obj, "column").value_or(0)) {}
+      line(
+          GetInteger<uint64_t>(obj, "line").value_or(LLDB_INVALID_LINE_NUMBER)),
+      column(GetInteger<uint64_t>(obj, "column")
+                 .value_or(LLDB_INVALID_COLUMN_NUMBER)) {}
 
 void SourceBreakpoint::SetBreakpoint(const llvm::StringRef source_path) {
   lldb::SBFileSpecList module_list;


        


More information about the lldb-commits mailing list