Skip to content

Commit e9b2edd

Browse files
[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 <[email protected]>
1 parent 21ff15f commit e9b2edd

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

lldb/source/API/SBLineEntry.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ void SBLineEntry::SetLine(uint32_t line) {
137137
void SBLineEntry::SetColumn(uint32_t column) {
138138
LLDB_INSTRUMENT_VA(this, column);
139139

140-
ref().line = column;
140+
ref().column = column;
141141
}
142142

143143
bool SBLineEntry::operator==(const SBLineEntry &rhs) const {

lldb/unittests/API/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
add_lldb_unittest(APITests
22
SBCommandInterpreterTest.cpp
3+
SBLineEntryTest.cpp
34

45
LINK_LIBS
56
liblldb
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//===-- SBLineEntryTest.cpp -------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===/
8+
9+
#include "gtest/gtest.h"
10+
11+
#include "lldb/API/LLDB.h"
12+
13+
TEST(SBLineEntryTest, SetLineAndColumn) {
14+
constexpr uint32_t expected_line_no = 40;
15+
constexpr uint32_t expected_column_no = 20;
16+
17+
lldb::SBLineEntry line_entry{};
18+
line_entry.SetLine(expected_line_no);
19+
line_entry.SetColumn(expected_column_no);
20+
21+
const uint32_t line_no = line_entry.GetLine();
22+
const uint32_t column_no = line_entry.GetColumn();
23+
24+
EXPECT_EQ(line_no, line_no);
25+
EXPECT_EQ(column_no, expected_column_no);
26+
}

0 commit comments

Comments
 (0)