Skip to content

Commit af9b970

Browse files
committed
[lldb-dap] Update with review changes
1 parent 1a1aa99 commit af9b970

File tree

4 files changed

+19
-23
lines changed

4 files changed

+19
-23
lines changed

lldb/tools/lldb-dap/DAP.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ DAP::DAP(llvm::StringRef path, Log *log, const ReplMode default_repl_mode,
8181
configuration_done_sent(false), waiting_for_run_in_terminal(false),
8282
progress_event_reporter(
8383
[&](const ProgressEvent &event) { SendJSON(event.ToJSON()); }),
84-
reverse_request_seq(0), repl_mode(default_repl_mode), goto_id_map() {}
84+
reverse_request_seq(0), repl_mode(default_repl_mode), gotos() {}
8585

8686
DAP::~DAP() = default;
8787

@@ -850,17 +850,17 @@ std::optional<lldb::SBLineEntry> Gotos::GetLineEntry(uint64_t id) const {
850850
}
851851

852852
uint64_t Gotos::InsertLineEntry(lldb::SBLineEntry line_entry) {
853-
const auto spec_id = this->NewSpecId();
853+
const auto spec_id = this->NewSpecID();
854854
line_entries.insert(std::make_pair(spec_id, line_entry));
855855
return spec_id;
856856
}
857857

858858
void Gotos::Clear() {
859-
new_id = 0UL;
859+
new_id = 0;
860860
line_entries.clear();
861861
}
862862

863-
uint64_t Gotos::NewSpecId() { return new_id++; }
863+
uint64_t Gotos::NewSpecID() { return new_id++; }
864864

865865
void Variables::Clear() {
866866
locals.Clear();

lldb/tools/lldb-dap/DAP.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ class Gotos {
9292
void Clear();
9393

9494
private:
95-
uint64_t NewSpecId();
95+
uint64_t NewSpecID();
9696

9797
llvm::DenseMap<uint64_t, lldb::SBLineEntry> line_entries;
98-
uint64_t new_id = 0ul;
98+
uint64_t new_id = 0;
9999
};
100100

101101
struct Variables {
@@ -226,7 +226,7 @@ struct DAP {
226226
// empty; if the previous expression was a variable expression, this string
227227
// will contain that expression.
228228
std::string last_nonempty_var_expression;
229-
Gotos goto_id_map;
229+
Gotos gotos;
230230

231231
/// Creates a new DAP sessions.
232232
///
@@ -391,7 +391,7 @@ struct DAP {
391391
/// Debuggee will continue from stopped state.
392392
void WillContinue() {
393393
variables.Clear();
394-
goto_id_map.Clear();
394+
gotos.Clear();
395395
}
396396

397397
/// Poll the process to wait for it to reach the eStateStopped state.

lldb/tools/lldb-dap/Handler/GoToRequestHandler.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
namespace lldb_dap {
1414

15-
/// Creates an \p StoppedEvent with the reason \a goto
15+
/// Creates an \p StoppedEvent with the reason \a goto.
1616
static void SendThreadGotoEvent(DAP &dap, lldb::tid_t thread_id) {
1717
llvm::json::Object event(CreateEventObject("stopped"));
1818
llvm::json::Object body;
@@ -83,31 +83,27 @@ void GoToRequestHandler::operator()(const llvm::json::Object &request) const {
8383

8484
const auto *goto_arguments = request.getObject("arguments");
8585
if (goto_arguments == nullptr) {
86-
SendError("Arguments is empty");
87-
return;
86+
return SendError("Arguments is empty");
8887
}
8988

9089
lldb::SBThread current_thread = dap.GetLLDBThread(*goto_arguments);
9190
if (!current_thread.IsValid()) {
92-
SendError(llvm::formatv("Thread id `{0}` is not valid",
93-
current_thread.GetThreadID()));
94-
return;
91+
return SendError(llvm::formatv("Thread id `{0}` is not valid",
92+
current_thread.GetThreadID()));
9593
}
9694

9795
const auto target_id = GetInteger<uint64_t>(goto_arguments, "targetId");
98-
const auto line_entry = dap.goto_id_map.GetLineEntry(target_id.value());
96+
const auto line_entry = dap.gotos.GetLineEntry(target_id.value());
9997
if (!target_id || !line_entry) {
100-
SendError(llvm::formatv("Target id `{0}` is not valid",
101-
current_thread.GetThreadID()));
102-
return;
98+
return SendError(llvm::formatv("Target id `{0}` is not valid",
99+
current_thread.GetThreadID()));
103100
}
104101

105102
auto file_spec = line_entry->GetFileSpec();
106103
const auto error =
107104
current_thread.JumpToLine(file_spec, line_entry->GetLine());
108105
if (error.Fail()) {
109-
SendError(error.GetCString());
110-
return;
106+
return SendError(error.GetCString());
111107
}
112108

113109
dap.SendJSON(llvm::json::Value(std::move(response)));

lldb/tools/lldb-dap/Handler/GoToTargetsRequestHandler.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ namespace lldb_dap {
1818

1919
static llvm::SmallVector<lldb::SBLineEntry>
2020
GetLineValidEntry(DAP &dap, const lldb::SBFileSpec &file_spec, uint32_t line) {
21-
// disable breakpoint listeners so they do not send events to the DAP client.
21+
// Disable breakpoint listeners so they do not send events to the DAP client.
2222
lldb::SBListener listener = dap.debugger.GetListener();
2323
lldb::SBBroadcaster broadcaster = dap.target.GetBroadcaster();
2424
constexpr auto event_mask = lldb::SBTarget::eBroadcastBitBreakpointChanged;
2525
listener.StopListeningForEvents(broadcaster, event_mask);
2626

27-
// create a breakpoint to resolve the line if it is on an empty line.
27+
// Create a breakpoint to resolve the line if it is on an empty line.
2828
lldb::SBBreakpoint goto_bp =
2929
dap.target.BreakpointCreateByLocation(file_spec, line);
3030
if (!goto_bp.IsValid())
@@ -142,7 +142,7 @@ void GoToTargetsRequestHandler::operator()(
142142
} else {
143143
llvm::json::Array response_targets;
144144
for (lldb::SBLineEntry &line_entry : goto_locations) {
145-
const uint64_t target_id = dap.goto_id_map.InsertLineEntry(line_entry);
145+
const uint64_t target_id = dap.gotos.InsertLineEntry(line_entry);
146146
const uint32_t target_line = line_entry.GetLine();
147147
auto target = llvm::json::Object();
148148
target.try_emplace("id", target_id);

0 commit comments

Comments
 (0)