llvm/llvm/include/llvm/Testing/Support/SupportHelpers.h

//===- Testing/Support/SupportHelpers.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_SUPPORT_SUPPORTHELPERS_H
#define LLVM_TESTING_SUPPORT_SUPPORTHELPERS_H

#include "llvm/ADT/SmallString.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/raw_os_ostream.h"
#include "gmock/gmock-matchers.h"
#include "gtest/gtest-printers.h"

#include <optional>
#include <string>

namespace llvm {
namespace detail {
struct ErrorHolder {};

template <typename T> struct ExpectedHolder : public ErrorHolder {};

inline void PrintTo(const ErrorHolder &Err, std::ostream *Out) {}

template <typename T>
void PrintTo(const ExpectedHolder<T> &Item, std::ostream *Out) {}

template <class InnerMatcher> class ValueIsMatcher {};
} // namespace detail

/// Matches an std::optional<T> with a value that conforms to an inner matcher.
/// To match std::nullopt you could use Eq(std::nullopt).
template <class InnerMatcher>
detail::ValueIsMatcher<InnerMatcher> ValueIs(const InnerMatcher &ValueMatcher) {}
namespace unittest {

SmallString<128> getInputFileDirectory(const char *Argv0);

/// A RAII object that creates a temporary directory upon initialization and
/// removes it upon destruction.
class TempDir {};

/// A RAII object that creates a link upon initialization and
/// removes it upon destruction.
///
/// The link may be a soft or a hard link, depending on the platform.
class TempLink {};

/// A RAII object that creates a file upon initialization and
/// removes it upon destruction.
class TempFile {};

} // namespace unittest
} // namespace llvm

#endif