From 0b57cec536236d46e3dba9bd041533462f33dbb7 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Fri, 20 Dec 2019 19:53:05 +0000 Subject: Move all sources from the llvm project into contrib/llvm-project. This uses the new layout of the upstream repository, which was recently migrated to GitHub, and converted into a "monorepo". That is, most of the earlier separate sub-projects with their own branches and tags were consolidated into one top-level directory, and are now branched and tagged together. Updating the vendor area to match this layout is next. --- contrib/llvm/lib/Support/Unix/Unix.h | 105 ----------------------------------- 1 file changed, 105 deletions(-) delete mode 100644 contrib/llvm/lib/Support/Unix/Unix.h (limited to 'contrib/llvm/lib/Support/Unix/Unix.h') diff --git a/contrib/llvm/lib/Support/Unix/Unix.h b/contrib/llvm/lib/Support/Unix/Unix.h deleted file mode 100644 index 86309b0567f5..000000000000 --- a/contrib/llvm/lib/Support/Unix/Unix.h +++ /dev/null @@ -1,105 +0,0 @@ -//===- llvm/Support/Unix/Unix.h - Common Unix Include File -------*- C++ -*-===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// -// This file defines things specific to Unix implementations. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_LIB_SUPPORT_UNIX_UNIX_H -#define LLVM_LIB_SUPPORT_UNIX_UNIX_H - -//===----------------------------------------------------------------------===// -//=== WARNING: Implementation here must contain only generic UNIX code that -//=== is guaranteed to work on all UNIX variants. -//===----------------------------------------------------------------------===// - -#include "llvm/Config/config.h" -#include "llvm/Support/Chrono.h" -#include "llvm/Support/Errno.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef HAVE_UNISTD_H -#include -#endif - -#ifdef HAVE_SYS_PARAM_H -#include -#endif - -#ifdef HAVE_SYS_TIME_H -# include -#endif -#include - -#ifdef HAVE_DLFCN_H -# include -#endif - -#ifdef HAVE_FCNTL_H -# include -#endif - -/// This function builds an error message into \p ErrMsg using the \p prefix -/// string and the Unix error number given by \p errnum. If errnum is -1, the -/// default then the value of errno is used. -/// Make an error message -/// -/// If the error number can be converted to a string, it will be -/// separated from prefix by ": ". -static inline bool MakeErrMsg( - std::string* ErrMsg, const std::string& prefix, int errnum = -1) { - if (!ErrMsg) - return true; - if (errnum == -1) - errnum = errno; - *ErrMsg = prefix + ": " + llvm::sys::StrError(errnum); - return true; -} - -namespace llvm { -namespace sys { - -/// Convert a struct timeval to a duration. Note that timeval can be used both -/// as a time point and a duration. Be sure to check what the input represents. -inline std::chrono::microseconds toDuration(const struct timeval &TV) { - return std::chrono::seconds(TV.tv_sec) + - std::chrono::microseconds(TV.tv_usec); -} - -/// Convert a time point to struct timespec. -inline struct timespec toTimeSpec(TimePoint<> TP) { - using namespace std::chrono; - - struct timespec RetVal; - RetVal.tv_sec = toTimeT(TP); - RetVal.tv_nsec = (TP.time_since_epoch() % seconds(1)).count(); - return RetVal; -} - -/// Convert a time point to struct timeval. -inline struct timeval toTimeVal(TimePoint TP) { - using namespace std::chrono; - - struct timeval RetVal; - RetVal.tv_sec = toTimeT(TP); - RetVal.tv_usec = (TP.time_since_epoch() % seconds(1)).count(); - return RetVal; -} - -} // namespace sys -} // namespace llvm - -#endif -- cgit v1.2.3