21#ifndef LLVM_SUPPORT_WINDOWSSUPPORT_H
22#define LLVM_SUPPORT_WINDOWSSUPPORT_H
28#define _WIN32_WINNT 0x0601
29#define WIN32_LEAN_AND_MEAN
38#include "llvm/Config/llvm-config.h"
46#include <system_error>
69bool MakeErrMsg(std::string *ErrMsg,
const std::string &prefix);
78template <
typename HandleTraits>
80 typedef typename HandleTraits::handle_type handle_type;
87 : Handle(HandleTraits::GetInvalid()) {}
93 if (HandleTraits::IsValid(Handle))
94 HandleTraits::Close(Handle);
98 handle_type t = Handle;
99 Handle = HandleTraits::GetInvalid();
104 if (HandleTraits::IsValid(Handle))
105 HandleTraits::Close(Handle);
111 explicit operator bool()
const {
112 return HandleTraits::IsValid(Handle) ?
true :
false;
115 operator handle_type()
const {
124 return INVALID_HANDLE_VALUE;
150 ::CryptReleaseContext(h, 0);
203 ULARGE_INTEGER TimeInteger;
204 TimeInteger.LowPart = Time.dwLowDateTime;
205 TimeInteger.HighPart = Time.dwHighDateTime;
208 return std::chrono::nanoseconds(100 * TimeInteger.QuadPart);
212 ULARGE_INTEGER TimeInteger;
213 TimeInteger.LowPart = Time.dwLowDateTime;
214 TimeInteger.HighPart = Time.dwHighDateTime;
217 TimeInteger.QuadPart -= 11644473600ll * 10000000;
220 return TimePoint<>(std::chrono::nanoseconds(100 * TimeInteger.QuadPart));
224 ULARGE_INTEGER TimeInteger;
225 TimeInteger.QuadPart = TP.time_since_epoch().count() / 100;
226 TimeInteger.QuadPart += 11644473600ll * 10000000;
229 Time.dwLowDateTime = TimeInteger.LowPart;
230 Time.dwHighDateTime = TimeInteger.HighPart;
244 size_t MaxPathLen = MAX_PATH);
This file defines the BumpPtrAllocator interface.
This file defines the SmallVector class.
Defines the llvm::VersionTuple class, which represents a version in the form major[....
Allocate memory in an ever growing pool, as if by bump-pointer.
ScopedHandle(handle_type h)
ScopedHandle & operator=(handle_type h)
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
pointer data()
Return a pointer to the vector's buffer, even if empty().
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Represents a version number in the form major[.minor[.subminor[.build]]].
std::error_code GetCommandLineArguments(SmallVectorImpl< const char * > &Args, BumpPtrAllocator &Alloc)
std::error_code widenPath(const Twine &Path8, SmallVectorImpl< wchar_t > &Path16, size_t MaxPathLen=MAX_PATH)
Convert UTF-8 path to a suitable UTF-16 path for use with the Win32 Unicode File API.
std::chrono::nanoseconds toDuration(FILETIME Time)
FILETIME toFILETIME(TimePoint<> TP)
std::chrono::time_point< std::chrono::system_clock, D > TimePoint
A time point on the system clock.
TimePoint< std::chrono::seconds > toTimePoint(std::time_t T)
Convert a std::time_t to a TimePoint.
This is an optimization pass for GlobalISel generic memory operations.
void ReportLastErrorFatal(const char *Msg)
ScopedHandle< CommonHandleTraits > ScopedCommonHandle
ScopedHandle< CryptContextTraits > ScopedCryptContext
llvm::VersionTuple GetWindowsOSVersion()
Returns the Windows version as Major.Minor.0.BuildNumber.
SmallVectorImpl< T >::const_pointer c_str(SmallVectorImpl< T > &str)
ScopedHandle< FindHandleTraits > ScopedFindHandle
bool RunningWindows8OrGreater()
Determines if the program is running on Windows 8 or newer.
ScopedHandle< JobHandleTraits > ScopedJobHandle
bool MakeErrMsg(std::string *ErrMsg, const std::string &prefix)
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
ScopedHandle< RegTraits > ScopedRegHandle
bool RunningWindows11OrGreater()
Determines if the program is running on Windows 11 or Windows Server 2022.
ScopedHandle< FileHandleTraits > ScopedFileHandle
static handle_type GetInvalid()
static void Close(handle_type h)
static bool IsValid(handle_type h)
static void Close(handle_type h)
static handle_type GetInvalid()
static bool IsValid(handle_type h)
static void Close(handle_type h)
static handle_type GetInvalid()
static handle_type GetInvalid()
static bool IsValid(handle_type h)
static void Close(handle_type h)