LLVM: llvm::sys Namespace Reference (original) (raw)

Namespaces
namespace detail
namespace fs
namespace locale
namespace path
namespace unicode
namespace windows
Classes
class DynamicLibrary
This class provides a portable interface to dynamic libraries which also might be known as shared libraries, shared objects, dynamic shared objects, or dynamic link libraries. More...
class InitializeCOMRAII
class Memory
This class provides various memory handling functions that manipulate MemoryBlock instances. More...
class MemoryBlock
This class encapsulates the notion of a memory block which has an address and a size. More...
class OwningMemoryBlock
Owning version of MemoryBlock. More...
class Process
A collection of legacy interfaces for querying information about the current executing process. More...
struct ProcessInfo
This struct encapsulates information about a process. More...
struct ProcessStatistics
This struct encapsulates information about a process execution. More...
class SmartMutex
SmartMutex - A mutex with a compile time constant parameter that indicates whether this mutex should become a no-op when we're not running in multithreaded mode. More...
class SmartRWMutex
SmartMutex - An R/W mutex with a compile time constant parameter that indicates whether this mutex should become a no-op when we're not running in multithreaded mode. More...
struct UnicodeCharRange
Represents a closed range of Unicode code points [Lower, Upper]. More...
class UnicodeCharSet
Holds a reference to an ordered array of UnicodeCharRange and allows to quickly check if a code point is contained in the set represented by this array. More...
class UtcClock
class Watchdog
This class provides an abstraction for a timeout around an operation that must complete in a given amount of time. More...
Typedefs
using cas_flag = uint32_t
template<typename D = std::chrono::nanoseconds>
using TimePoint = std::chrono::time_point<std::chrono::system_clock, D>
A time point on the system clock.
template<typename D = std::chrono::nanoseconds>
using UtcTime = std::chrono::time_point<UtcClock, D>
using Mutex = SmartMutex
Mutex - A standard, always enforced mutex.
template<bool mt_only>
using SmartScopedLock = std::lock_guard<SmartMutex<mt_only>>
using ScopedLock = SmartScopedLock
using procid_t = ::pid_t
using process_t = procid_t
using RWMutex = SmartRWMutex
template<bool mt_only>
using SmartScopedReader = const std::shared_lock<SmartRWMutex<mt_only>>
ScopedReader - RAII acquisition of a reader lock.
using ScopedReader = SmartScopedReader
template<bool mt_only>
using SmartScopedWriter = std::lock_guard<SmartRWMutex<mt_only>>
ScopedWriter - RAII acquisition of a writer lock.
using ScopedWriter = SmartScopedWriter
using SignalHandlerCallback = void (*)(void *)
Enumerations
enum class COMThreadingMode { SingleThreaded, MultiThreaded }
enum WindowsEncodingMethod { WEM_UTF8, WEM_CurrentCodePage, WEM_UTF16 }
File encoding options when writing contents that a non-UTF8 tool will read (on Windows systems). More...
Functions
LLVM_ABI void MemoryFence ()
LLVM_ABI cas_flag CompareAndSwap (volatile cas_flag *ptr, cas_flag new_value, cas_flag old_value)
UtcTime< std::chrono::seconds > toUtcTime (std::time_t T)
Convert a std::time_t to a UtcTime.
std::time_t toTimeT (TimePoint<> TP)
Convert a TimePoint to std::time_t.
std::time_t toTimeT (UtcTime<> TP)
Convert a UtcTime to std::time_t.
TimePoint< std::chrono::seconds > toTimePoint (std::time_t T)
Convert a std::time_t to a TimePoint.
TimePoint toTimePoint (std::time_t T, uint32_t nsec)
Convert a std::time_t + nanoseconds to a TimePoint.
LLVM_ABI std::string StrError ()
Returns a string representation of the errno value, using whatever thread-safe variant of strerror() is available.
LLVM_ABI std::string StrError (int errnum)
Like the no-argument version above, but uses errnum instead of errno.
template<typename FailT, typename Fun, typename... Args>
decltype(auto) RetryAfterSignal (const FailT &Fail, const Fun &F, const Args &... As)
raw_ostream & operator<< (raw_ostream &OS, const Memory::ProtectionFlags &PF)
Debugging output for Memory::ProtectionFlags.
raw_ostream & operator<< (raw_ostream &OS, const MemoryBlock &MB)
Debugging output for MemoryBlock.
LLVM_ABI ErrorOr< std::string > findProgramByName (StringRef Name, ArrayRef< StringRef > Paths={})
Find the first executable file Name in Paths.
LLVM_ABI std::error_code ChangeStdinMode (fs::OpenFlags Flags)
LLVM_ABI std::error_code ChangeStdoutMode (fs::OpenFlags Flags)
LLVM_ABI std::error_code ChangeStdinToBinary ()
LLVM_ABI std::error_code ChangeStdoutToBinary ()
LLVM_ABI int ExecuteAndWait (StringRef Program, ArrayRef< StringRef > Args, std::optional< ArrayRef< StringRef > > Env=std::nullopt, ArrayRef< std::optional< StringRef > > Redirects={}, unsigned SecondsToWait=0, unsigned MemoryLimit=0, std::string *ErrMsg=nullptr, bool *ExecutionFailed=nullptr, std::optional< ProcessStatistics > *ProcStat=nullptr, BitVector *AffinityMask=nullptr)
This function executes the program using the arguments provided.
LLVM_ABI ProcessInfo ExecuteNoWait (StringRef Program, ArrayRef< StringRef > Args, std::optional< ArrayRef< StringRef > > Env, ArrayRef< std::optional< StringRef > > Redirects={}, unsigned MemoryLimit=0, std::string *ErrMsg=nullptr, bool *ExecutionFailed=nullptr, BitVector *AffinityMask=nullptr, bool DetachProcess=false)
Similar to ExecuteAndWait, but returns immediately.
LLVM_ABI bool commandLineFitsWithinSystemLimits (StringRef Program, ArrayRef< StringRef > Args)
Return true if the given arguments fit within system-specific argument length limits.
LLVM_ABI bool commandLineFitsWithinSystemLimits (StringRef Program, ArrayRef< const char * > Args)
Return true if the given arguments fit within system-specific argument length limits.
LLVM_ABI std::error_code writeFileWithEncoding (StringRef FileName, StringRef Contents, WindowsEncodingMethod Encoding=WEM_UTF8)
Saves the UTF8-encoded contents string into the file FileName using a specific encoding.
LLVM_ABI ProcessInfo Wait (const ProcessInfo &PI, std::optional< unsigned > SecondsToWait, std::string *ErrMsg=nullptr, std::optional< ProcessStatistics > *ProcStat=nullptr, bool Polling=false)
This function waits for the process specified by PI to finish.
LLVM_ABI void printArg (llvm::raw_ostream &OS, StringRef Arg, bool Quote)
Print a command argument, and optionally quote it.
LLVM_ABI void RunInterruptHandlers ()
This function runs all the registered interrupt handlers, including the removal of files registered by RemoveFileOnSignal.
LLVM_ABI bool RemoveFileOnSignal (StringRef Filename, std::string *ErrMsg=nullptr)
This function registers signal handlers to ensure that if a signal gets delivered that the named file is removed.
LLVM_ABI void DontRemoveFileOnSignal (StringRef Filename)
This function removes a file from the list of files to be removed on signal delivery.
LLVM_ABI void PrintStackTraceOnErrorSignal (StringRef Argv0, bool DisableCrashReporting=false)
When an error signal (such as SIGABRT or SIGSEGV) is delivered to the process, print a stack trace and then exit.
LLVM_ABI void DisableSystemDialogsOnCrash ()
Disable all system dialog boxes that appear when the process crashes.
LLVM_ABI void PrintStackTrace (raw_ostream &OS, int Depth=0)
Print the stack trace using the given raw_ostream object.
LLVM_ABI void RunSignalHandlers ()
LLVM_ABI void AddSignalHandler (SignalHandlerCallback FnPtr, void *Cookie)
Add a function to be called when an abort/kill signal is delivered to the process.
LLVM_ABI void SetInterruptFunction (void(*IF)())
This function registers a function to be called when the user "interrupts" the program (typically by pressing ctrl-c).
LLVM_ABI void SetInfoSignalFunction (void(*Handler)())
Registers a function to be called when an "info" signal is delivered to the process.
LLVM_ABI void SetOneShotPipeSignalFunction (void(*Handler)())
Registers a function to be called in a "one-shot" manner when a pipe signal is delivered to the process (i.e., on a failed write to a pipe).
LLVM_ABI void DefaultOneShotPipeSignalHandler ()
On Unix systems and Windows, this function exits with an "IO error" exit code.
LLVM_ABI void CleanupOnSignal (uintptr_t Context)
This function does the following:
LLVM_ABI void unregisterHandlers ()
unsigned char getSwappedBytes (unsigned char C)
signed char getSwappedBytes (signed char C)
char getSwappedBytes (char C)
unsigned short getSwappedBytes (unsigned short C)
signed short getSwappedBytes (signed short C)
unsigned int getSwappedBytes (unsigned int C)
signed int getSwappedBytes (signed int C)
unsigned long getSwappedBytes (unsigned long C)
signed long getSwappedBytes (signed long C)
unsigned long long getSwappedBytes (unsigned long long C)
signed long long getSwappedBytes (signed long long C)
float getSwappedBytes (float C)
double getSwappedBytes (double C)
template<typename T>
std::enable_if_t< std::is_enum_v< T >, T > getSwappedBytes (T C)
template<typename T>
void swapByteOrder (T &Value)
bool operator< (uint32_t Value, UnicodeCharRange Range)
bool operator< (UnicodeCharRange Range, uint32_t Value)
LLVM_ABI bool RunningOnValgrind ()
LLVM_ABI void ValgrindDiscardTranslations (const void *Addr, size_t Len)
std::chrono::nanoseconds toDuration (FILETIME Time)
TimePoint toTimePoint (FILETIME Time)
FILETIME toFILETIME (TimePoint<> TP)
LLVM_ABI std::string getDefaultTargetTriple ()
getDefaultTargetTriple() - Return the default target triple the compiler has been configured to produce code for.
LLVM_ABI std::string getProcessTriple ()
getProcessTriple() - Return an appropriate target triple for generating code to be loaded into the current process, e.g.
LLVM_ABI StringRef getHostCPUName ()
getHostCPUName - Get the LLVM name for the host CPU.
LLVM_ABI StringMap< bool, MallocAllocator > getHostCPUFeatures ()
getHostCPUFeatures - Get the LLVM names for the host CPU features.
LLVM_ABI void printDefaultTargetAndDetectedCPU (raw_ostream &OS)
This is a function compatible with cl::AddExtraVersionPrinter, which adds info about the current target triple and detected CPU.
std::chrono::microseconds toDuration (const struct timeval &TV)
Convert a struct timeval to a duration.
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.
Variables
const char EnvPathSeparator = ':'
This is the OS-specific separator for PATH like environment variables:
constexpr bool IsBigEndianHost
constexpr bool IsLittleEndianHost = IsBigEndianHost

cas_flag

Mutex

Mutex - A standard, always enforced mutex.

Definition at line 66 of file Mutex.h.

process_t

procid_t

using llvm::sys::procid_t = ::pid_t

RWMutex

ScopedLock

ScopedReader

ScopedWriter

SignalHandlerCallback

using llvm::sys::SignalHandlerCallback = void (*)(void *)

SmartScopedLock

SmartScopedReader

ScopedReader - RAII acquisition of a reader lock.

Definition at line 170 of file RWMutex.h.

SmartScopedWriter

ScopedWriter - RAII acquisition of a writer lock.

Definition at line 187 of file RWMutex.h.

TimePoint

template<typename D = std::chrono::nanoseconds>

A time point on the system clock.

This is provided for two reasons:

Definition at line 34 of file Chrono.h.

UtcTime

template<typename D = std::chrono::nanoseconds>

COMThreadingMode

Enumerator
SingleThreaded
MultiThreaded

Definition at line 22 of file COM.h.

WindowsEncodingMethod

File encoding options when writing contents that a non-UTF8 tool will read (on Windows systems).

For UNIX, we always use UTF-8.

Enumerator
WEM_UTF8 UTF-8 is the LLVM native encoding, being the same as "do not perform encoding conversion".
WEM_CurrentCodePage
WEM_UTF16

Definition at line 173 of file Program.h.

AddSignalHandler()

LLVM_ABI void llvm::sys::AddSignalHandler ( SignalHandlerCallback FnPtr,
void * Cookie )

ChangeStdinMode()

ChangeStdinToBinary()

LLVM_ABI std::error_code llvm::sys::ChangeStdinToBinary ( )

ChangeStdoutMode()

ChangeStdoutToBinary()

LLVM_ABI std::error_code llvm::sys::ChangeStdoutToBinary ( )

CleanupOnSignal()

LLVM_ABI void llvm::sys::CleanupOnSignal ( uintptr_t Context )

This function does the following:

References LLVM_ABI.

commandLineFitsWithinSystemLimits() [1/2]

Return true if the given arguments fit within system-specific argument length limits.

Definition at line 75 of file Program.cpp.

References commandLineFitsWithinSystemLimits().

commandLineFitsWithinSystemLimits() [2/2]

CompareAndSwap()

sys::cas_flag llvm::sys::CompareAndSwap ( volatile cas_flag * ptr,
sys::cas_flag new_value,
sys::cas_flag old_value )

DefaultOneShotPipeSignalHandler()

LLVM_ABI void llvm::sys::DefaultOneShotPipeSignalHandler ( )

DisableSystemDialogsOnCrash()

LLVM_ABI void llvm::sys::DisableSystemDialogsOnCrash ( )

DontRemoveFileOnSignal()

ExecuteAndWait()

This function executes the program using the arguments provided.

The invoked program will inherit the stdin, stdout, and stderr file descriptors, the environment and other configuration settings of the invoking program. This function waits for the program to finish, so should be avoided in library functions that aren't expected to block. Consider using ExecuteNoWait() instead.

Returns

an integer result code indicating the status of the program. A zero or positive value indicates the result code of the program. -1 indicates failure to execute -2 indicates a crash during execution or timeout

Parameters

Program Path of the program to be executed. It is presumed this is the result of the findProgramByName method.
Args An array of strings that are passed to the program. The first element should be the name of the program. The array should not be terminated by an empty StringRef.
Env An optional vector of strings to use for the program's environment. If not provided, the current program's environment will be used. If specified, the vector should not be terminated by an empty StringRef.
Redirects An array of optional paths. Should have a size of zero or three. If the array is empty, no redirections are performed. Otherwise, the inferior process's stdin(0), stdout(1), and stderr(2) will be redirected to the corresponding paths, if the optional path is present (not std::nullopt). When an empty path is passed in, the corresponding file descriptor will be disconnected (ie, /dev/null'd) in a portable way.
SecondsToWait If non-zero, this specifies the amount of time to wait for the child process to exit. If the time expires, the child is killed and this call returns. If zero, this function will wait until the child finishes or forever if it doesn't.
MemoryLimit If non-zero, this specifies max. amount of memory can be allocated by process. If memory usage will be higher limit, the child is killed and this call returns. If zero no memory limit.
ErrMsg If non-zero, provides a pointer to a string instance in which error messages will be returned. If the string is non-empty upon return an error occurred while invoking the program.
ProcStat If non-zero,
AffinityMask provides a pointer to a structure in which process execution statistics will be stored. CPUs or processors the new program shall run on.

Definition at line 32 of file Program.cpp.

References assert(), Execute(), and llvm::Wait.

Referenced by collectAddressSymbols(), llvm::doSystemDiff(), ExecGraphViewer(), llvm::DotCfgChangeReporter::genHTML(), llvm::IRChangedTester::handleIR(), and validateOutOfProcess().

ExecuteNoWait()

Similar to ExecuteAndWait, but returns immediately.

Returns

The ProcessInfo of the newly launched process.

Note

On Microsoft Windows systems, users will need to either call Wait until the process has finished executing or win32's CloseHandle API on ProcessInfo.ProcessHandle to avoid memory leaks.

Parameters

DetachProcess If true the executed program detatches from the controlling terminal. I/O streams such as llvm::outs, llvm::errs, and stdin will be closed until redirected to another output location

Definition at line 57 of file Program.cpp.

References assert(), and Execute().

Referenced by ExecGraphViewer().

findProgramByName()

Find the first executable file Name in Paths.

This does not perform hashing as a shell would but instead stats each PATH entry individually so should generally be avoided. Core LLVM library functions and options should instead require fully specified paths.

Parameters

Name name of the executable to find. If it contains any system slashes, it will be returned as is.
Paths optional list of paths to search for Name. If empty it will use the system PATH environment instead.

Returns

The fully qualified path to the first Name in Paths if it exists. Name if Name has slashes in it. Otherwise an error.

References LLVM_ABI.

Referenced by llvm::doSystemDiff(), llvm::DotCfgChangeReporter::genHTML(), and llvm::IRChangedTester::handleIR().

getDefaultTargetTriple()

LLVM_ABI std::string llvm::sys::getDefaultTargetTriple ( )

getHostCPUFeatures()

getHostCPUName()

getProcessTriple()

std::string llvm::sys::getProcessTriple ( )

getProcessTriple() - Return an appropriate target triple for generating code to be loaded into the current process, e.g.

when using the JIT.

Definition at line 2512 of file Host.cpp.

References llvm::Triple::get32BitArchVariant(), llvm::Triple::get64BitArchVariant(), llvm::Triple::isArch32Bit(), llvm::Triple::isArch64Bit(), llvm::Triple::normalize(), and llvm::Triple::str().

Referenced by llvm::orc::SelfExecutorProcessControl::Create(), llvm::orc::JITTargetMachineBuilder::detectHost(), llvm::getSubDirectoryPath(), llvm::orc::ObjectFileLoader::isArchitectureCompatible(), and llvm::EngineBuilder::selectTarget().

getSwappedBytes() [1/14]

char llvm::sys::getSwappedBytes ( char C) inline

getSwappedBytes() [2/14]

double llvm::sys::getSwappedBytes ( double C) inline

getSwappedBytes() [3/14]

float llvm::sys::getSwappedBytes ( float C) inline

getSwappedBytes() [4/14]

signed char llvm::sys::getSwappedBytes ( signed char C) inline

getSwappedBytes() [5/14]

signed int llvm::sys::getSwappedBytes ( signed int C) inline

getSwappedBytes() [6/14]

signed long llvm::sys::getSwappedBytes ( signed long C) inline

getSwappedBytes() [7/14]

signed long long llvm::sys::getSwappedBytes ( signed long long C) inline

getSwappedBytes() [8/14]

signed short llvm::sys::getSwappedBytes ( signed short C) inline

getSwappedBytes() [9/14]

template<typename T>

std::enable_if_t< std::is_enum_v< T >, T > llvm::sys::getSwappedBytes ( T C) inline

getSwappedBytes() [10/14]

getSwappedBytes() [11/14]

getSwappedBytes() [12/14]

getSwappedBytes() [13/14]

getSwappedBytes() [14/14]

MemoryFence()

void llvm::sys::MemoryFence ( )

operator<() [1/2]

operator<() [2/2]

operator<<() [1/2]

operator<<() [2/2]

printArg()

printDefaultTargetAndDetectedCPU()

void llvm::sys::printDefaultTargetAndDetectedCPU ( raw_ostream & OS )

PrintStackTrace()

Print the stack trace using the given [raw_ostream](classllvm%5F1%5F1raw%5F%5Fostream.html "This class implements an extremely fast bulk output stream that can only output to a stream.") object.

Parameters

Depth refers to the number of stackframes to print. If not specified, the entire frame is printed.

References llvm::Depth, and LLVM_ABI.

PrintStackTraceOnErrorSignal()

LLVM_ABI void llvm::sys::PrintStackTraceOnErrorSignal ( StringRef Argv0,
bool DisableCrashReporting = false )

When an error signal (such as SIGABRT or SIGSEGV) is delivered to the process, print a stack trace and then exit.

Print a stack trace if a fatal signal occurs.

Parameters

Argv0 the current binary name, used to find the symbolizer relative to the current binary before searching PATH;canbeStringRef(),inwhichcasewewillonlysearchPATH; can be StringRef(), in which case we will only search PATH;canbeStringRef(),inwhichcasewewillonlysearchPATH.
DisableCrashReporting if true, disable the normal crash reporting mechanisms on the underlying operating system.

References LLVM_ABI.

Referenced by llvm::InitLLVM::InitLLVM().

RemoveFileOnSignal()

RetryAfterSignal()

template<typename FailT, typename Fun, typename... Args>

decltype(auto) llvm::sys::RetryAfterSignal ( const FailT & Fail, const Fun & F, const Args &... As ) inline

RunInterruptHandlers()

LLVM_ABI void llvm::sys::RunInterruptHandlers ( )

RunningOnValgrind()

bool llvm::sys::RunningOnValgrind ( )

RunSignalHandlers()

void llvm::sys::RunSignalHandlers ( )

SetInfoSignalFunction()

LLVM_ABI void llvm::sys::SetInfoSignalFunction ( void(* Handler )() )

Registers a function to be called when an "info" signal is delivered to the process.

On POSIX systems, this will be SIGUSR1; on systems that have it, SIGINFO will also be used (typically ctrl-t).

Note that signal handlers are not allowed to call any non-reentrant functions. An null function pointer disables the current installed function. Note also that the handler may be executed on a different thread on some platforms.

References LLVM_ABI.

Referenced by llvm::EnablePrettyStackTraceOnSigInfoForThisThread().

SetInterruptFunction()

LLVM_ABI void llvm::sys::SetInterruptFunction ( void(* IF )() )

This function registers a function to be called when the user "interrupts" the program (typically by pressing ctrl-c).

When the user interrupts the program, the specified interrupt function is called instead of the program being killed, and the interrupt function automatically disabled.

Note that interrupt functions are not allowed to call any non-reentrant functions. An null interrupt function pointer disables the current installed function. Note also that the handler may be executed on a different thread on some platforms.

References LLVM_ABI.

SetOneShotPipeSignalFunction()

LLVM_ABI void llvm::sys::SetOneShotPipeSignalFunction ( void(* Handler )() )

Registers a function to be called in a "one-shot" manner when a pipe signal is delivered to the process (i.e., on a failed write to a pipe).

After the pipe signal is handled once, the handler is unregistered.

The LLVM signal handling code will not install any handler for the pipe signal unless one is provided with this API (see DefaultOneShotPipeSignalHandler). This handler must be provided before any other LLVM signal handlers are installed: the InitLLVM constructor has a flag that can simplify this setup.

Note that the handler is not allowed to call any non-reentrant functions. A null handler pointer disables the current installed function. Note also that the handler may be executed on a different thread on some platforms.

References LLVM_ABI.

Referenced by llvm::InitLLVM::InitLLVM().

StrError() [1/2]

std::string llvm::sys::StrError ( )

Returns a string representation of the errno value, using whatever thread-safe variant of strerror() is available.

Be sure to call this immediately after the function that set errno, or errno may have been overwritten by an intervening call.

Definition at line 26 of file Errno.cpp.

References StrError().

Referenced by MakeErrMsg(), and StrError().

StrError() [2/2]

std::string llvm::sys::StrError ( int errnum )

Like the no-argument version above, but uses errnum instead of errno.

Definition at line 30 of file Errno.cpp.

swapByteOrder()

template<typename T>

void llvm::sys::swapByteOrder ( T & Value) inline

Definition at line 61 of file SwapByteOrder.h.

References getSwappedBytes(), and T.

Referenced by llvm::support::endian::byte_swap(), checkThreadCommand(), llvm::dwarf_linker::parallel::CompileUnit::cloneDieAttrExpression(), llvm::orc::shared::SPSSerializationTraits< SPSTagT, SPSTagT, std::enable_if_t< std::is_same< SPSTagT, bool >::value||std::is_same< SPSTagT, char >::value||std::is_same< SPSTagT, int8_t >::value||std::is_same< SPSTagT, int16_t >::value||std::is_same< SPSTagT, int32_t >::value||std::is_same< SPSTagT, int64_t >::value||std::is_same< SPSTagT, uint8_t >::value||std::is_same< SPSTagT, uint16_t >::value||std::is_same< SPSTagT, uint32_t >::value||std::is_same< SPSTagT, uint64_t >::value > >::deserialize(), llvm::dwarf_linker::parallel::SectionDescriptor::emitIntVal(), llvm::hashing::detail::fetch32(), llvm::hashing::detail::fetch64(), getArray(), llvm::object::MachOObjectFile::getChainedFixupsSegments(), llvm::object::MachOChainedFixupEntry::moveNext(), readInteger(), llvm::orc::shared::SPSSerializationTraits< SPSTagT, SPSTagT, std::enable_if_t< std::is_same< SPSTagT, bool >::value||std::is_same< SPSTagT, char >::value||std::is_same< SPSTagT, int8_t >::value||std::is_same< SPSTagT, int16_t >::value||std::is_same< SPSTagT, int32_t >::value||std::is_same< SPSTagT, int64_t >::value||std::is_same< SPSTagT, uint8_t >::value||std::is_same< SPSTagT, uint16_t >::value||std::is_same< SPSTagT, uint32_t >::value||std::is_same< SPSTagT, uint64_t >::value > >::serialize(), llvm::dxbc::AmplificationPSVInfo::swapBytes(), llvm::dxbc::BitcodeHeader::swapBytes(), llvm::dxbc::ContainerVersion::swapBytes(), llvm::dxbc::DomainPSVInfo::swapBytes(), llvm::dxbc::GeometryPSVInfo::swapBytes(), llvm::dxbc::Header::swapBytes(), llvm::dxbc::HullPSVInfo::swapBytes(), llvm::dxbc::MeshPSVInfo::swapBytes(), llvm::dxbc::PartHeader::swapBytes(), llvm::dxbc::ProgramHeader::swapBytes(), llvm::dxbc::ProgramSignatureElement::swapBytes(), llvm::dxbc::ProgramSignatureHeader::swapBytes(), llvm::dxbc::PSV::v0::ResourceBindInfo::swapBytes(), llvm::dxbc::PSV::v0::RuntimeInfo::swapBytes(), llvm::dxbc::PSV::v0::SignatureElement::swapBytes(), llvm::dxbc::PSV::v1::RuntimeInfo::swapBytes(), llvm::dxbc::PSV::v2::ResourceBindInfo::swapBytes(), llvm::dxbc::PSV::v2::RuntimeInfo::swapBytes(), llvm::dxbc::PSV::v3::RuntimeInfo::swapBytes(), llvm::dxbc::RTS0::v1::DescriptorRange::swapBytes(), llvm::dxbc::RTS0::v1::RootConstants::swapBytes(), llvm::dxbc::RTS0::v1::RootDescriptor::swapBytes(), llvm::dxbc::RTS0::v1::RootParameterHeader::swapBytes(), llvm::dxbc::RTS0::v1::RootSignatureHeader::swapBytes(), llvm::dxbc::RTS0::v1::StaticSampler::swapBytes(), llvm::dxbc::RTS0::v2::DescriptorRange::swapBytes(), llvm::dxbc::RTS0::v2::RootDescriptor::swapBytes(), llvm::dxbc::RTS0::v3::StaticSampler::swapBytes(), llvm::dxbc::ShaderHash::swapBytes(), llvm::object::detail::swapBytes(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::MachO::swapStruct(), llvm::objcopy::dxbc::DXContainerWriter::write(), and writeInteger().

toDuration() [1/2]

std::chrono::microseconds llvm::sys::toDuration ( const struct timeval & TV) inline

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.

Definition at line 74 of file Unix.h.

toDuration() [2/2]

std::chrono::nanoseconds llvm::sys::toDuration ( FILETIME Time) inline

toFILETIME()

FILETIME llvm::sys::toFILETIME ( TimePoint<> TP) inline

toTimePoint() [1/3]

TimePoint llvm::sys::toTimePoint ( FILETIME Time) inline

toTimePoint() [2/3]

TimePoint< std::chrono::seconds > llvm::sys::toTimePoint ( std::time_t T) inline

toTimePoint() [3/3]

TimePoint llvm::sys::toTimePoint ( std::time_t T, uint32_t nsec ) inline

Convert a std::time_t + nanoseconds to a TimePoint.

Definition at line 72 of file Chrono.h.

References T.

toTimeSpec()

struct timespec llvm::sys::toTimeSpec ( TimePoint<> TP) inline

toTimeT() [1/2]

std::time_t llvm::sys::toTimeT ( TimePoint<> TP) inline

toTimeT() [2/2]

std::time_t llvm::sys::toTimeT ( UtcTime<> TP) inline

Convert a UtcTime to std::time_t.

Definition at line 57 of file Chrono.h.

toTimeVal()

struct timeval llvm::sys::toTimeVal ( TimePoint< std::chrono::microseconds > TP) inline

toUtcTime()

UtcTime< std::chrono::seconds > llvm::sys::toUtcTime ( std::time_t T) inline

Convert a std::time_t to a UtcTime.

Definition at line 44 of file Chrono.h.

References T.

unregisterHandlers()

LLVM_ABI void llvm::sys::unregisterHandlers ( )

ValgrindDiscardTranslations()

void llvm::sys::ValgrindDiscardTranslations ( const void * Addr,
size_t Len )

Wait()

This function waits for the process specified by PI to finish.

Returns

A

See also

ProcessInfo struct with Pid set to:

Note

Users of this function should always check the ReturnCode member of the

See also

ProcessInfo returned from this function.

Parameters

PI The child process that should be waited on.
SecondsToWait If std::nullopt, waits until child has terminated. If a value, this specifies the amount of time to wait for the child process. If the time expires, and Polling is false, the child is killed and this < function returns. If the time expires and Polling is true, the child is resumed.

If zero, this function will perform a non-blocking wait on the child process.

Parameters

ErrMsg If non-zero, provides a pointer to a string instance in which error messages will be returned. If the string is non-empty upon return an error occurred while invoking the program.
ProcStat If non-zero, provides
Polling a pointer to a structure in which process execution statistics will be stored. If true, do not kill the process on timeout.

References LLVM_ABI.

writeFileWithEncoding()

Saves the UTF8-encoded contents string into the file FileName using a specific encoding.

This write file function adds the possibility to choose which encoding to use when writing a text file. On Windows, this is important when writing files with internationalization support with an encoding that is different from the one used in LLVM (UTF-8). We use this when writing response files, since GCC tools on MinGW only understand legacy code pages, and VisualStudio tools only understand UTF-16. For UNIX, using different encodings is silently ignored, since all tools work well with UTF-8. This function assumes that you only use UTF-8 text data and will convert it to your desired encoding before writing to the file.

FIXME: We use EM_CurrentCodePage to write response files for GNU tools in a MinGW/MinGW-w64 environment, which has serious flaws but currently is our best shot to make gcc/ld understand international characters. This should be changed as soon as binutils fix this to support UTF16 on mingw.

Returns

non-zero error_code if failed

References WEM_UTF8.

EnvPathSeparator

IsBigEndianHost

bool llvm::sys::IsBigEndianHost constexpr

Initial value:

Definition at line 26 of file SwapByteOrder.h.

Referenced by llvm::FoldingSetNodeID::AddString(), llvm::object::convertUTF16LEToUTF8String(), llvm::orc::shared::SPSSerializationTraits< SPSTagT, SPSTagT, std::enable_if_t< std::is_same< SPSTagT, bool >::value||std::is_same< SPSTagT, char >::value||std::is_same< SPSTagT, int8_t >::value||std::is_same< SPSTagT, int16_t >::value||std::is_same< SPSTagT, int32_t >::value||std::is_same< SPSTagT, int64_t >::value||std::is_same< SPSTagT, uint8_t >::value||std::is_same< SPSTagT, uint16_t >::value||std::is_same< SPSTagT, uint32_t >::value||std::is_same< SPSTagT, uint64_t >::value > >::deserialize(), llvm::hashing::detail::fetch32(), llvm::hashing::detail::fetch64(), llvm::mcdxbc::PSVRuntimeInfo::finalize(), llvm::object::ViewArray< T >::iterator::operator*(), llvm::object::DirectX::PSVRuntimeInfo::parse(), readInteger(), llvm::object::DirectX::RootParameterView::readParameter(), readStruct(), llvm::orc::shared::SPSSerializationTraits< SPSTagT, SPSTagT, std::enable_if_t< std::is_same< SPSTagT, bool >::value||std::is_same< SPSTagT, char >::value||std::is_same< SPSTagT, int8_t >::value||std::is_same< SPSTagT, int16_t >::value||std::is_same< SPSTagT, int32_t >::value||std::is_same< SPSTagT, int64_t >::value||std::is_same< SPSTagT, uint8_t >::value||std::is_same< SPSTagT, uint16_t >::value||std::is_same< SPSTagT, uint32_t >::value||std::is_same< SPSTagT, uint64_t >::value > >::serialize(), llvm::mcdxbc::Signature::write(), llvm::objcopy::dxbc::DXContainerWriter::write(), and llvm::DXContainerObjectWriter::writeObject().

IsLittleEndianHost

bool llvm::sys::IsLittleEndianHost = IsBigEndianHost constexpr

Definition at line 29 of file SwapByteOrder.h.

Referenced by llvm::FoldingSetNodeID::AddString(), checkThreadCommand(), llvm::MCStreamer::emitIntValue(), extractSections(), llvm::InstrProfCorrelator::Context::get(), getArray(), llvm::object::MachOObjectFile::getChainedFixupsSegments(), getStruct(), getStructOrErr(), llvm::DataExtractor::getU24(), getUniversalBinaryStruct(), LLVMInitializeBPFTargetMC(), llvm::LoadIntFromMemory(), llvm::yaml::MappingTraits< MachOYAML::Object >::mapping(), llvm::object::MachOChainedFixupEntry::moveNext(), parseBPFArch(), llvm::StoreIntToMemory(), llvm::ExecutionEngine::StoreValueToMemory(), writeInteger(), writeNListEntry(), and writeUniversalArchsToStream().