9 #ifndef LLDB_UTILITY_TIMEOUT_H
10 #define LLDB_UTILITY_TIMEOUT_H
12 #include "llvm/ADT/Optional.h"
13 #include "llvm/Support/Chrono.h"
14 #include "llvm/Support/FormatProviders.h"
27 template <
typename Ratio>
28 class Timeout :
public llvm::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 = llvm::Optional<Dur<Ratio>>;
41 template <
typename Ratio2,
42 typename =
typename EnableIf<int64_t, Ratio2>::type>
46 template <
typename Rep2,
typename Ratio2,
47 typename =
typename EnableIf<Rep2, Ratio2>::type>
48 Timeout(
const std::chrono::duration<Rep2, Ratio2> &other)
55 template<
typename Ratio>
58 raw_ostream &OS, StringRef Options) {
64 format_provider<Dur>::format(*timeout, OS, Options);
69 #endif // LLDB_UTILITY_TIMEOUT_H