LLVM 20.0.0git
|
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 | |
typedef uint32_t | cas_flag |
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 > |
typedef SmartMutex< false > | Mutex |
Mutex - A standard, always enforced mutex. | |
template<bool mt_only> | |
using | SmartScopedLock = std::lock_guard< SmartMutex< mt_only > > |
typedef SmartScopedLock< false > | ScopedLock |
typedef ::pid_t | procid_t |
typedef procid_t | process_t |
typedef SmartRWMutex< false > | RWMutex |
template<bool mt_only> | |
using | SmartScopedReader = const std::shared_lock< SmartRWMutex< mt_only > > |
ScopedReader - RAII acquisition of a reader lock. | |
typedef SmartScopedReader< false > | ScopedReader |
template<bool mt_only> | |
using | SmartScopedWriter = std::lock_guard< SmartRWMutex< mt_only > > |
ScopedWriter - RAII acquisition of a writer lock. | |
typedef SmartScopedWriter< false > | ScopedWriter |
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 | |
void | MemoryFence () |
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. | |
std::string | StrError () |
Returns a string representation of the errno value, using whatever thread-safe variant of strerror() is available. | |
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. | |
ErrorOr< std::string > | findProgramByName (StringRef Name, ArrayRef< StringRef > Paths={}) |
Find the first executable file Name in Paths . | |
std::error_code | ChangeStdinMode (fs::OpenFlags Flags) |
std::error_code | ChangeStdoutMode (fs::OpenFlags Flags) |
std::error_code | ChangeStdinToBinary () |
std::error_code | ChangeStdoutToBinary () |
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. | |
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. | |
bool | commandLineFitsWithinSystemLimits (StringRef Program, ArrayRef< StringRef > Args) |
Return true if the given arguments fit within system-specific argument length limits. | |
bool | commandLineFitsWithinSystemLimits (StringRef Program, ArrayRef< const char * > Args) |
Return true if the given arguments fit within system-specific argument length limits. | |
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. | |
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. | |
void | printArg (llvm::raw_ostream &OS, StringRef Arg, bool Quote) |
Print a command argument, and optionally quote it. | |
void | RunInterruptHandlers () |
This function runs all the registered interrupt handlers, including the removal of files registered by RemoveFileOnSignal. | |
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. | |
void | DontRemoveFileOnSignal (StringRef Filename) |
This function removes a file from the list of files to be removed on signal delivery. | |
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. | |
void | DisableSystemDialogsOnCrash () |
Disable all system dialog boxes that appear when the process crashes. | |
void | PrintStackTrace (raw_ostream &OS, int Depth=0) |
Print the stack trace using the given raw_ostream object. | |
void | RunSignalHandlers () |
void | AddSignalHandler (SignalHandlerCallback FnPtr, void *Cookie) |
Add a function to be called when an abort/kill signal is delivered to the process. | |
void | SetInterruptFunction (void(*IF)()) |
This function registers a function to be called when the user "interrupts" the program (typically by pressing ctrl-c). | |
void | SetInfoSignalFunction (void(*Handler)()) |
Registers a function to be called when an "info" signal is delivered to the process. | |
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). | |
void | DefaultOneShotPipeSignalHandler () |
On Unix systems and Windows, this function exits with an "IO error" exit code. | |
void | CleanupOnSignal (uintptr_t Context) |
This function does the following: | |
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) |
bool | RunningOnValgrind () |
void | ValgrindDiscardTranslations (const void *Addr, size_t Len) |
std::chrono::nanoseconds | toDuration (FILETIME Time) |
TimePoint | toTimePoint (FILETIME Time) |
FILETIME | toFILETIME (TimePoint<> TP) |
std::string | getDefaultTargetTriple () |
getDefaultTargetTriple() - Return the default target triple the compiler has been configured to produce code for. | |
std::string | getProcessTriple () |
getProcessTriple() - Return an appropriate target triple for generating code to be loaded into the current process, e.g. | |
StringRef | getHostCPUName () |
getHostCPUName - Get the LLVM name for the host CPU. | |
const StringMap< bool, MallocAllocator > | getHostCPUFeatures () |
getHostCPUFeatures - Get the LLVM names for the host CPU features. | |
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 |
static const bool | IsLittleEndianHost = !IsBigEndianHost |
typedef uint32_t llvm::sys::cas_flag |
typedef SmartMutex<false> llvm::sys::Mutex |
typedef procid_t llvm::sys::process_t |
typedef ::pid_t llvm::sys::procid_t |
typedef SmartRWMutex<false> llvm::sys::RWMutex |
typedef SmartScopedLock<false> llvm::sys::ScopedLock |
typedef SmartScopedReader<false> llvm::sys::ScopedReader |
typedef SmartScopedWriter<false> llvm::sys::ScopedWriter |
using llvm::sys::SignalHandlerCallback = typedef void (*)(void *) |
using llvm::sys::SmartScopedLock = typedef std::lock_guard<SmartMutex<mt_only> > |
using llvm::sys::SmartScopedReader = typedef const std::shared_lock<SmartRWMutex<mt_only> > |
using llvm::sys::SmartScopedWriter = typedef std::lock_guard<SmartRWMutex<mt_only> > |
using llvm::sys::TimePoint = typedef std::chrono::time_point<std::chrono::system_clock, D> |
A time point on the system clock.
This is provided for two reasons:
using llvm::sys::UtcTime = typedef std::chrono::time_point<UtcClock, D> |
|
strong |
void llvm::sys::AddSignalHandler | ( | SignalHandlerCallback | FnPtr, |
void * | Cookie | ||
) |
Add a function to be called when an abort/kill signal is delivered to the process.
The handler can have a cookie passed to it to identify what instance of the handler it is.
Referenced by llvm::dbgs(), llvm::InitLLVM::InitLLVM(), and llvm::PrintCrashIRInstrumentation::registerCallbacks().
std::error_code llvm::sys::ChangeStdinMode | ( | fs::OpenFlags | Flags | ) |
Referenced by llvm::MemoryBuffer::getSTDIN().
std::error_code llvm::sys::ChangeStdinToBinary | ( | ) |
std::error_code llvm::sys::ChangeStdoutMode | ( | fs::OpenFlags | Flags | ) |
Referenced by getFD().
std::error_code llvm::sys::ChangeStdoutToBinary | ( | ) |
void llvm::sys::CleanupOnSignal | ( | uintptr_t | Context | ) |
This function does the following:
bool llvm::sys::commandLineFitsWithinSystemLimits | ( | StringRef | Program, |
ArrayRef< const char * > | Args | ||
) |
Return true if the given arguments fit within system-specific argument length limits.
Definition at line 75 of file Program.cpp.
References A, commandLineFitsWithinSystemLimits(), llvm::SmallVectorImpl< T >::emplace_back(), and llvm::SmallVectorImpl< T >::reserve().
Return true if the given arguments fit within system-specific argument length limits.
Referenced by commandLineFitsWithinSystemLimits().
sys::cas_flag llvm::sys::CompareAndSwap | ( | volatile cas_flag * | ptr, |
sys::cas_flag | new_value, | ||
sys::cas_flag | old_value | ||
) |
Definition at line 44 of file Atomic.cpp.
Referenced by llvm::call_once().
void llvm::sys::DefaultOneShotPipeSignalHandler | ( | ) |
On Unix systems and Windows, this function exits with an "IO error" exit code.
Referenced by llvm::InitLLVM::InitLLVM().
void llvm::sys::DisableSystemDialogsOnCrash | ( | ) |
Disable all system dialog boxes that appear when the process crashes.
Referenced by llvm::CrashRecoveryContext::CrashRecoveryContext().
void llvm::sys::DontRemoveFileOnSignal | ( | StringRef | Filename | ) |
This function removes a file from the list of files to be removed on signal delivery.
Referenced by llvm::sys::fs::TempFile::discard(), llvm::sys::fs::TempFile::keep(), llvm::CleanupInstaller::~CleanupInstaller(), and llvm::LockFileManager::~LockFileManager().
int llvm::sys::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.
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.
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
|
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 llvm::doSystemDiff(), ExecGraphViewer(), llvm::DotCfgChangeReporter::genHTML(), llvm::IRChangedTester::handleIR(), and printSymbolizedStackTrace().
ProcessInfo llvm::sys::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.
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().
ErrorOr< std::string > llvm::sys::findProgramByName | ( | StringRef | Name, |
ArrayRef< StringRef > | Paths = {} |
||
) |
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.
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. |
Name
in Paths
if it exists. Name
if Name
has slashes in it. Otherwise an error. Referenced by llvm::doSystemDiff(), llvm::DotCfgChangeReporter::genHTML(), llvm::IRChangedTester::handleIR(), and printSymbolizedStackTrace().
std::string llvm::sys::getDefaultTargetTriple | ( | ) |
getDefaultTargetTriple() - Return the default target triple the compiler has been configured to produce code for.
The target triple is a string in the format of: CPU_TYPE-VENDOR-OPERATING_SYSTEM or CPU_TYPE-VENDOR-KERNEL-OPERATING_SYSTEM
Referenced by llvm::object::Archive::getDefaultKind(), llvm::object::MachOObjectFile::getHostArch(), LLVMGetDefaultTargetTriple(), and printDefaultTargetAndDetectedCPU().
getHostCPUFeatures - Get the LLVM names for the host CPU features.
The particular format of the names are target dependent, and suitable for passing as -mattr to the target which matches the host.
Definition at line 2177 of file Host.cpp.
Referenced by llvm::orc::JITTargetMachineBuilder::detectHost(), llvm::codegen::getFeatureList(), llvm::codegen::getFeaturesStr(), and LLVMGetHostCPUFeatures().
StringRef llvm::sys::getHostCPUName | ( | ) |
getHostCPUName - Get the LLVM name for the host CPU.
The particular format of the name is target dependent, and suitable for passing as -mcpu to the target which matches the host.
Definition at line 1735 of file Host.cpp.
Referenced by llvm::orc::JITTargetMachineBuilder::detectHost(), llvm::codegen::getCPUStr(), llvm::PPC::getNormalizedPPCTargetCPU(), LLVMGetHostCPUName(), and printDefaultTargetAndDetectedCPU().
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 2211 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(), and llvm::EngineBuilder::selectTarget().
Definition at line 33 of file SwapByteOrder.h.
References llvm::byteswap(), and llvm::CallingConv::C.
|
inline |
Definition at line 51 of file SwapByteOrder.h.
References llvm::byteswap(), and llvm::CallingConv::C.
|
inline |
Definition at line 47 of file SwapByteOrder.h.
References llvm::byteswap(), and llvm::CallingConv::C.
Definition at line 32 of file SwapByteOrder.h.
References llvm::byteswap(), and llvm::CallingConv::C.
|
inline |
Definition at line 39 of file SwapByteOrder.h.
References llvm::byteswap(), and llvm::CallingConv::C.
|
inline |
Definition at line 42 of file SwapByteOrder.h.
References llvm::byteswap(), and llvm::CallingConv::C.
|
inline |
Definition at line 45 of file SwapByteOrder.h.
References llvm::byteswap(), and llvm::CallingConv::C.
|
inline |
Definition at line 36 of file SwapByteOrder.h.
References llvm::byteswap(), and llvm::CallingConv::C.
|
inline |
Definition at line 56 of file SwapByteOrder.h.
References llvm::byteswap(), llvm::CallingConv::C, and llvm::to_underlying().
Definition at line 31 of file SwapByteOrder.h.
References llvm::byteswap(), and llvm::CallingConv::C.
Referenced by swapByteOrder().
Definition at line 38 of file SwapByteOrder.h.
References llvm::byteswap(), and llvm::CallingConv::C.
Definition at line 41 of file SwapByteOrder.h.
References llvm::byteswap(), and llvm::CallingConv::C.
Definition at line 44 of file SwapByteOrder.h.
References llvm::byteswap(), and llvm::CallingConv::C.
Definition at line 35 of file SwapByteOrder.h.
References llvm::byteswap(), and llvm::CallingConv::C.
void llvm::sys::MemoryFence | ( | ) |
Definition at line 30 of file Atomic.cpp.
Referenced by llvm::call_once().
|
inline |
Definition at line 28 of file UnicodeCharRanges.h.
References Range.
|
inline |
Definition at line 31 of file UnicodeCharRanges.h.
References Range.
raw_ostream & llvm::sys::operator<< | ( | raw_ostream & | OS, |
const Memory::ProtectionFlags & | PF | ||
) |
Debugging output for Memory::ProtectionFlags.
Definition at line 34 of file Memory.cpp.
References assert(), llvm::sys::Memory::MF_EXEC, llvm::sys::Memory::MF_READ, llvm::sys::Memory::MF_WRITE, and OS.
raw_ostream & llvm::sys::operator<< | ( | raw_ostream & | OS, |
const MemoryBlock & | MB | ||
) |
Debugging output for MemoryBlock.
Definition at line 43 of file Memory.cpp.
References llvm::sys::MemoryBlock::allocatedSize(), llvm::sys::MemoryBlock::base(), and OS.
void llvm::sys::printArg | ( | llvm::raw_ostream & | OS, |
StringRef | Arg, | ||
bool | Quote | ||
) |
Print a command argument, and optionally quote it.
Definition at line 84 of file Program.cpp.
References llvm::StringRef::find_first_of(), llvm::StringRef::npos, and OS.
void llvm::sys::printDefaultTargetAndDetectedCPU | ( | raw_ostream & | OS | ) |
This is a function compatible with cl::AddExtraVersionPrinter, which adds info about the current target triple and detected CPU.
Definition at line 2229 of file Host.cpp.
References getDefaultTargetTriple(), getHostCPUName(), and OS.
void llvm::sys::PrintStackTrace | ( | raw_ostream & | OS, |
int | Depth = 0 |
||
) |
Print the stack trace using the given raw_ostream
object.
Depth | refers to the number of stackframes to print. If not specified, the entire frame is printed. |
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.
Argv0 | the current binary name, used to find the symbolizer relative to the current binary before searching $PATH; can be StringRef(), in which case we will only search $PATH. |
DisableCrashReporting | if true , disable the normal crash reporting mechanisms on the underlying operating system. |
Referenced by llvm::InitLLVM::InitLLVM().
This function registers signal handlers to ensure that if a signal gets delivered that the named file is removed.
Remove a file if a fatal signal occurs.
Referenced by llvm::CleanupInstaller::CleanupInstaller(), and llvm::sys::fs::TempFile::create().
void llvm::sys::RunInterruptHandlers | ( | ) |
This function runs all the registered interrupt handlers, including the removal of files registered by RemoveFileOnSignal.
Referenced by llvm::fatal_exit(), and llvm::report_fatal_error().
bool llvm::sys::RunningOnValgrind | ( | ) |
Definition at line 32 of file Valgrind.cpp.
void llvm::sys::RunSignalHandlers | ( | ) |
Definition at line 98 of file Signals.cpp.
References CallBacksToRun(), CallbackAndCookie::Empty, CallbackAndCookie::Executing, and CallbackAndCookie::Initialized.
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.
Referenced by llvm::EnablePrettyStackTraceOnSigInfoForThisThread().
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.
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.
Referenced by llvm::InitLLVM::InitLLVM().
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.
Referenced by MakeErrMsg().
std::string llvm::sys::StrError | ( | int | errnum | ) |
Definition at line 61 of file SwapByteOrder.h.
References getSwappedBytes().
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::ShaderHash::swapBytes(), llvm::dxbc::ContainerVersion::swapBytes(), llvm::dxbc::Header::swapBytes(), llvm::dxbc::PartHeader::swapBytes(), llvm::dxbc::BitcodeHeader::swapBytes(), llvm::dxbc::ProgramHeader::swapBytes(), llvm::dxbc::HullPSVInfo::swapBytes(), llvm::dxbc::DomainPSVInfo::swapBytes(), llvm::dxbc::GeometryPSVInfo::swapBytes(), llvm::dxbc::MeshPSVInfo::swapBytes(), llvm::dxbc::AmplificationPSVInfo::swapBytes(), llvm::dxbc::PSV::v0::RuntimeInfo::swapBytes(), llvm::dxbc::PSV::v0::ResourceBindInfo::swapBytes(), llvm::dxbc::PSV::v0::SignatureElement::swapBytes(), llvm::dxbc::PSV::v2::RuntimeInfo::swapBytes(), llvm::dxbc::PSV::v2::ResourceBindInfo::swapBytes(), llvm::dxbc::PSV::v3::RuntimeInfo::swapBytes(), llvm::dxbc::ProgramSignatureHeader::swapBytes(), llvm::dxbc::ProgramSignatureElement::swapBytes(), llvm::object::detail::swapBytes(), llvm::dxbc::PSV::v1::RuntimeInfo::swapBytes(), llvm::MachO::swapStruct(), and writeInteger().
|
inline |
|
inline |
Definition at line 202 of file WindowsSupport.h.
|
inline |
Definition at line 223 of file WindowsSupport.h.
|
inline |
Definition at line 211 of file WindowsSupport.h.
|
inline |
Convert a std::time_t to a TimePoint.
Definition at line 65 of file Chrono.h.
Referenced by computeMemberData(), llvm::object::AbstractArchiveMemberHeader::getLastModified(), llvm::vfs::detail::NewInMemoryNodeInfo::makeStatus(), and llvm::writeArchiveToStream().
|
inline |
Convert a time point to struct timespec.
Definition at line 87 of file Unix.h.
References llvm::count(), and toTimeT().
|
inline |
Convert a TimePoint to std::time_t.
Definition at line 50 of file Chrono.h.
Referenced by llvm::getStructTM(), llvm::getStructTMUtc(), printBigArchiveMemberHeader(), printRestOfMemberHeader(), toTimeSpec(), and toTimeVal().
|
inline |
|
inline |
Convert a time point to struct timeval.
Definition at line 97 of file Unix.h.
References llvm::count(), and toTimeT().
|
inline |
void llvm::sys::unregisterHandlers | ( | ) |
Referenced by llvm::CrashRecoveryContext::throwIfCrash().
void llvm::sys::ValgrindDiscardTranslations | ( | const void * | Addr, |
size_t | Len | ||
) |
Definition at line 36 of file Valgrind.cpp.
ProcessInfo llvm::sys::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.
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.
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. |
std::error_code llvm::sys::writeFileWithEncoding | ( | StringRef | FileName, |
StringRef | Contents, | ||
WindowsEncodingMethod | Encoding = WEM_UTF8 |
||
) |
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.
This is the OS-specific separator for PATH like environment variables:
Definition at line 32 of file Program.h.
Referenced by llvm::findVCToolChainViaEnvironment().
|
constexpr |
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(), 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(), and llvm::DXContainerObjectWriter::writeObject().
|
static |
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::object::MachOChainedFixupEntry::moveNext(), parseBPFArch(), llvm::StoreIntToMemory(), llvm::ExecutionEngine::StoreValueToMemory(), writeInteger(), writeNListEntry(), and writeUniversalArchsToStream().