[Lldb-commits] [lldb] [llvm] [lldb][lldb-dap] Implement jump to cursor (PR #130503)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 25 11:12:27 PDT 2025


================
@@ -77,6 +77,27 @@ enum class PacketStatus {
 
 enum class ReplMode { Variable = 0, Command, Auto };
 
+class Gotos {
+public:
+  /// \return the line_entry corresponding with \p id
+  ///
+  /// If \p id is invalid std::nullopt is returned.
+  std::optional<lldb::SBLineEntry> GetLineEntry(uint64_t id) const;
+
+  /// Insert a new \p line_entry.
+  /// \return id assigned to this line_entry.
+  uint64_t InsertLineEntry(lldb::SBLineEntry line_entry);
+
+  /// Clears all line entries and reset the generated ids.
+  void Clear();
+
+private:
+  uint64_t NewSpecID();
+
+  llvm::DenseMap<uint64_t, lldb::SBLineEntry> line_entries;
+  uint64_t new_id = 0;
----------------
clayborg wrote:

Do we need a llvm::DenseMap here? I was thinking we can just use a `std::vector<lldb::SBLineEntry>' and just return an index to the entry as the result of `uint64_t InsertLineEntry(lldb::SBLineEntry line_entry);`?

https://github.com/llvm/llvm-project/pull/130503


More information about the lldb-commits mailing list