13#ifndef LLVM_LIB_SUPPORT_UNIX_UNIX_H
14#define LLVM_LIB_SUPPORT_UNIX_UNIX_H
21#include "llvm/Config/config.h"
60 std::string* ErrMsg,
const std::string& prefix,
int errnum = -1) {
81inline std::chrono::microseconds
toDuration(
const struct timeval &TV) {
82 return std::chrono::seconds(TV.tv_sec) +
83 std::chrono::microseconds(TV.tv_usec);
88 using namespace std::chrono;
90 struct timespec RetVal;
92 RetVal.tv_nsec = (TP.time_since_epoch() % seconds(1)).
count();
98 using namespace std::chrono;
100 struct timeval RetVal;
102 RetVal.tv_usec = (TP.time_since_epoch() % seconds(1)).
count();
static bool MakeErrMsg(std::string *ErrMsg, const std::string &prefix, int errnum=-1)
This function builds an error message into ErrMsg using the prefix string and the Unix error number g...
static void ReportErrnumFatal(const char *Msg, int errnum)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
std::chrono::nanoseconds toDuration(FILETIME Time)
std::string StrError()
Returns a string representation of the errno value, using whatever thread-safe variant of strerror() ...
std::chrono::time_point< std::chrono::system_clock, D > TimePoint
A time point on the system clock.
struct timespec toTimeSpec(TimePoint<> TP)
Convert a time point to struct timespec.
struct timeval toTimeVal(TimePoint< std::chrono::microseconds > TP)
Convert a time point to struct timeval.
std::time_t toTimeT(TimePoint<> TP)
Convert a TimePoint to std::time_t.
This is an optimization pass for GlobalISel generic memory operations.
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
auto count(R &&Range, const E &Element)
Wrapper function around std::count to count the number of times an element Element occurs in the give...
Implement std::hash so that hash_code can be used in STL containers.