[Lldb-commits] [lldb] e9b2edd - [lldb] fix set SBLineEntryColumn (#130435)
via lldb-commits
lldb-commits at lists.llvm.org
Mon Mar 10 09:10:27 PDT 2025
Author: Ebuka Ezike
Date: 2025-03-10T09:10:23-07:00
New Revision: e9b2eddd5be753e72010da8a4333df8195e1641c
URL: https://github.com/llvm/llvm-project/commit/e9b2eddd5be753e72010da8a4333df8195e1641c
DIFF: https://github.com/llvm/llvm-project/commit/e9b2eddd5be753e72010da8a4333df8195e1641c.diff
LOG: [lldb] fix set SBLineEntryColumn (#130435)
Calling the public API `SBLineEntry::SetColumn()` sets the row instead
of the column.
This probably should be backported as it has been since version 3.4.
---------
Co-authored-by: Jonas Devlieghere <jonas at devlieghere.com>
Added:
lldb/unittests/API/SBLineEntryTest.cpp
Modified:
lldb/source/API/SBLineEntry.cpp
lldb/unittests/API/CMakeLists.txt
Removed:
################################################################################
diff --git a/lldb/source/API/SBLineEntry.cpp b/lldb/source/API/SBLineEntry.cpp
index 216ea6d18eab8..0f4936f32a074 100644
--- a/lldb/source/API/SBLineEntry.cpp
+++ b/lldb/source/API/SBLineEntry.cpp
@@ -137,7 +137,7 @@ void SBLineEntry::SetLine(uint32_t line) {
void SBLineEntry::SetColumn(uint32_t column) {
LLDB_INSTRUMENT_VA(this, column);
- ref().line = column;
+ ref().column = column;
}
bool SBLineEntry::operator==(const SBLineEntry &rhs) const {
diff --git a/lldb/unittests/API/CMakeLists.txt b/lldb/unittests/API/CMakeLists.txt
index 52e9a5e991515..fe2ff684a5d92 100644
--- a/lldb/unittests/API/CMakeLists.txt
+++ b/lldb/unittests/API/CMakeLists.txt
@@ -1,5 +1,6 @@
add_lldb_unittest(APITests
SBCommandInterpreterTest.cpp
+ SBLineEntryTest.cpp
LINK_LIBS
liblldb
diff --git a/lldb/unittests/API/SBLineEntryTest.cpp b/lldb/unittests/API/SBLineEntryTest.cpp
new file mode 100644
index 0000000000000..518893b554bd1
--- /dev/null
+++ b/lldb/unittests/API/SBLineEntryTest.cpp
@@ -0,0 +1,26 @@
+//===-- SBLineEntryTest.cpp -------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===/
+
+#include "gtest/gtest.h"
+
+#include "lldb/API/LLDB.h"
+
+TEST(SBLineEntryTest, SetLineAndColumn) {
+ constexpr uint32_t expected_line_no = 40;
+ constexpr uint32_t expected_column_no = 20;
+
+ lldb::SBLineEntry line_entry{};
+ line_entry.SetLine(expected_line_no);
+ line_entry.SetColumn(expected_column_no);
+
+ const uint32_t line_no = line_entry.GetLine();
+ const uint32_t column_no = line_entry.GetColumn();
+
+ EXPECT_EQ(line_no, line_no);
+ EXPECT_EQ(column_no, expected_column_no);
+}
More information about the lldb-commits
mailing list