brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · f8a14f4 Raw
41 lines · c
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef LLDB_UNITTESTS_PROTOCOL_PROTOCOLMCPTESTUTILITIES_H10#define LLDB_UNITTESTS_PROTOCOL_PROTOCOLMCPTESTUTILITIES_H11 12#include "lldb/Protocol/MCP/Protocol.h"13#include "llvm/Support/FormatVariadic.h"14#include "llvm/Support/JSON.h" // IWYU pragma: keep15#include "gtest/gtest.h"       // IWYU pragma: keep16#include <ostream>17#include <variant>18 19namespace lldb_protocol::mcp {20 21inline void PrintTo(const Request &req, std::ostream *os) {22  *os << llvm::formatv("{0}", toJSON(req)).str();23}24 25inline void PrintTo(const Response &resp, std::ostream *os) {26  *os << llvm::formatv("{0}", toJSON(resp)).str();27}28 29inline void PrintTo(const Notification &note, std::ostream *os) {30  *os << llvm::formatv("{0}", toJSON(note)).str();31}32 33inline void PrintTo(const Message &message, std::ostream *os) {34  return std::visit([os](auto &&message) { return PrintTo(message, os); },35                    message);36}37 38} // namespace lldb_protocol::mcp39 40#endif41