[Lldb-commits] [lldb] [lldb-dap] Move requests into their own object/file (PR #128262)

John Harrison via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 21 18:25:08 PST 2025


================
@@ -0,0 +1,45 @@
+//===-- Request.h ---------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_TOOLS_LLDB_DAP_REQUEST_REQUEST_H
+#define LLDB_TOOLS_LLDB_DAP_REQUEST_REQUEST_H
+
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/JSON.h"
+
+namespace lldb_dap {
+struct DAP;
+
+class Request {
+public:
+  Request(DAP &dap) : dap(dap) {}
+  virtual ~Request() = default;
+
+  virtual void operator()(const llvm::json::Object &request) = 0;
+
+  static llvm::StringLiteral getName() { return "invalid"; };
----------------
ashgti wrote:

Should this be named `getCommand`? In the protocol, the requests are keyed by the command field, so it aligns more with the spec.

Should this assert to help ensure we catch missing?

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


More information about the lldb-commits mailing list