llvm/llvm/include/llvm/Testing/ADT/StringMapEntry.h

//===- llvm/Testing/ADT/StringMapEntry.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 LLVM_TESTING_ADT_STRINGMAPENTRY_H_
#define LLVM_TESTING_ADT_STRINGMAPENTRY_H_

#include "llvm/ADT/StringMapEntry.h"
#include "gmock/gmock.h"
#include <ostream>
#include <type_traits>

namespace llvm {
namespace detail {

template <typename T, typename = std::void_t<>>
struct CanOutputToOStream : std::false_type {};

CanOutputToOStream<T, std::void_t<decltype(std::declval<std::ostream &>() << std::declval<T>())>>;

} // namespace detail

/// Support for printing to std::ostream, for use with e.g. producing more
/// useful error messages with Google Test.
template <typename T>
std::ostream &operator<<(std::ostream &OS, const StringMapEntry<T> &E) {}

namespace detail {

template <typename StringMapEntryT>
class StringMapEntryMatcherImpl
    : public testing::MatcherInterface<StringMapEntryT> {};

template <typename KeyMatcherT, typename ValueMatcherT>
class StringMapEntryMatcher {};

} // namespace detail

/// Returns a gMock matcher that matches a `StringMapEntry` whose string key
/// matches `KeyMatcher`, and whose value matches `ValueMatcher`.
template <typename KeyMatcherT, typename ValueMatcherT>
detail::StringMapEntryMatcher<KeyMatcherT, ValueMatcherT>
IsStringMapEntry(KeyMatcherT KM, ValueMatcherT VM) {}

} // namespace llvm

#endif