9#ifndef LLDB_UTILITY_TIMEOUT_H
10#define LLDB_UTILITY_TIMEOUT_H
12#include "llvm/Support/Chrono.h"
13#include "llvm/Support/FormatProviders.h"
27template <
typename Ratio>
28class Timeout :
public std::optional<std::chrono::duration<int64_t, Ratio>> {
30 template <
typename Ratio2>
using Dur = std::chrono::duration<int64_t, Ratio2>;
31 template <
typename Rep2,
typename Ratio2>
33 std::is_convertible<std::chrono::duration<Rep2, Ratio2>,
34 std::chrono::duration<int64_t, Ratio>>::value>;
36 using Base = std::optional<Dur<Ratio>>;
41 template <
typename Ratio2,
42 typename =
typename EnableIf<int64_t, Ratio2>::type>
44 :
Base(other ?
Base(
Dur<Ratio>(*other)) : std::nullopt) {}
46 template <
typename Rep2,
typename Ratio2,
47 typename =
typename EnableIf<Rep2, Ratio2>::type>
48 Timeout(
const std::chrono::duration<Rep2, Ratio2> &other)
55template<
typename Ratio>
58 raw_ostream &OS, StringRef Options) {
64 format_provider<Dur>::format(*timeout, OS, Options);
std::chrono::duration< int64_t, Ratio2 > Dur
std::optional< Dur< Ratio > > Base
std::enable_if< std::is_convertible< std::chrono::duration< Rep2, Ratio2 >, std::chrono::duration< int64_t, Ratio > >::value > EnableIf
Timeout(const Timeout< Ratio2 > &other)
Timeout(const std::chrono::duration< Rep2, Ratio2 > &other)
Timeout(std::nullopt_t none)
A class that represents a running process on the host machine.