Jonas Devlieghere de51b2dd3c
[lldb] Move Transport class into lldb_private (NFC) (#143806)
Move lldb-dap's Transport class into lldb_private so the code can be
shared between the "JSON with header" protocol used by DAP and the JSON
RPC protocol used by MCP (see [1]).

[1]: https://discourse.llvm.org/t/rfc-adding-mcp-support-to-lldb/86798
2025-06-11 19:51:05 -07:00

27 lines
920 B
C++

//===-- Transport.cpp -----------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
#include "Transport.h"
#include "DAPLog.h"
#include "lldb/lldb-forward.h"
#include "llvm/ADT/StringRef.h"
using namespace llvm;
using namespace lldb;
using namespace lldb_private;
using namespace lldb_dap;
Transport::Transport(llvm::StringRef client_name, lldb_dap::Log *log,
lldb::IOObjectSP input, lldb::IOObjectSP output)
: HTTPDelimitedJSONTransport(input, output), m_client_name(client_name),
m_log(log) {}
void Transport::Log(llvm::StringRef message) {
DAP_LOG(m_log, "({0}) {1}", m_client_name, message);
}