Skip to content

Commit 066f2e2

Browse files
committed
[lldb][lldb-dap] use std::vector instead of llvm::DenseMap.
1 parent 17e6c85 commit 066f2e2

File tree

2 files changed

+7
-17
lines changed

2 files changed

+7
-17
lines changed

lldb/tools/lldb-dap/DAP.cpp

+6-13
Original file line numberDiff line numberDiff line change
@@ -842,25 +842,18 @@ lldb::SBError DAP::WaitForProcessToStop(uint32_t seconds) {
842842
}
843843

844844
std::optional<lldb::SBLineEntry> Gotos::GetLineEntry(uint64_t id) const {
845-
const auto iter = line_entries.find(id);
846-
if (iter != line_entries.end())
847-
return iter->second;
845+
if (id > line_entries.size())
846+
return std::nullopt;
848847

849-
return std::nullopt;
848+
return line_entries[id - 1]; // id starts at one.
850849
}
851850

852851
uint64_t Gotos::InsertLineEntry(lldb::SBLineEntry line_entry) {
853-
const auto spec_id = this->NewSpecID();
854-
line_entries.insert(std::make_pair(spec_id, line_entry));
855-
return spec_id;
852+
line_entries.emplace_back(line_entry);
853+
return line_entries.size();
856854
}
857855

858-
void Gotos::Clear() {
859-
new_id = 0;
860-
line_entries.clear();
861-
}
862-
863-
uint64_t Gotos::NewSpecID() { return new_id++; }
856+
void Gotos::Clear() { line_entries.clear(); }
864857

865858
void Variables::Clear() {
866859
locals.Clear();

lldb/tools/lldb-dap/DAP.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,7 @@ class Gotos {
9292
void Clear();
9393

9494
private:
95-
uint64_t NewSpecID();
96-
97-
llvm::DenseMap<uint64_t, lldb::SBLineEntry> line_entries;
98-
uint64_t new_id = 0;
95+
std::vector<lldb::SBLineEntry> line_entries;
9996
};
10097

10198
struct Variables {

0 commit comments

Comments
 (0)