Go to the documentation of this file.
13 #ifndef LLVM_SUPPORT_PROGRAM_H
14 #define LLVM_SUPPORT_PROGRAM_H
18 #include "llvm/Config/llvm-config.h"
23 #include <system_error>
31 #if defined(LLVM_ON_UNIX)
33 #elif defined (_WIN32)
115 ArrayRef<std::optional<StringRef>> Redirects = {},
123 unsigned SecondsToWait = 0,
128 unsigned MemoryLimit = 0,
132 std::string *ErrMsg =
nullptr,
136 bool *ExecutionFailed =
nullptr,
137 std::optional<ProcessStatistics> *ProcStat =
nullptr,
140 BitVector *AffinityMask =
nullptr
150 std::optional<ArrayRef<StringRef>> Env,
151 ArrayRef<std::optional<StringRef>> Redirects = {},
152 unsigned MemoryLimit = 0,
153 std::string *ErrMsg =
nullptr,
154 bool *ExecutionFailed =
nullptr,
155 BitVector *AffinityMask =
nullptr);
160 ArrayRef<StringRef>
Args);
165 ArrayRef<const char *>
Args);
210 std::optional<unsigned> SecondsToWait,
219 std::string *ErrMsg =
nullptr,
223 std::optional<ProcessStatistics> *ProcStat =
ErrorOr< std::string > findProgramByName(StringRef Name, ArrayRef< StringRef > Paths={})
Find the first executable file Name in Paths.
This is an optimization pass for GlobalISel generic memory operations.
std::error_code ChangeStdoutMode(fs::OpenFlags Flags)
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.
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 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)
Similar to ExecuteAndWait, but returns immediately.
@ WEM_UTF8
UTF-8 is the LLVM native encoding, being the same as "do not perform encoding conversion".
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
const char EnvPathSeparator
This is the OS-specific separator for PATH like environment variables:
process_t Process
The process identifier.
std::error_code ChangeStdoutToBinary()
std::chrono::microseconds UserTime
This class implements an extremely fast bulk output stream that can only output to a stream.
This struct encapsulates information about a process execution.
std::error_code ChangeStdinToBinary()
int ReturnCode
Platform-dependent process object.
WindowsEncodingMethod
File encoding options when writing contents that a non-UTF8 tool will read (on Windows systems).
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
StringRef - Represent a constant reference to a string, i.e.
This struct encapsulates information about a process.
std::error_code ChangeStdinMode(fs::OpenFlags Flags)
uint64_t PeakMemory
Maximum resident set size in KiB.
Represents either an error or a value T.
ArrayRef(const T &OneElt) -> ArrayRef< T >
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.
void printArg(llvm::raw_ostream &OS, StringRef Arg, bool Quote)
Print a command argument, and optionally quote it.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
bool commandLineFitsWithinSystemLimits(StringRef Program, ArrayRef< StringRef > Args)
Return true if the given arguments fit within system-specific argument length limits.
std::chrono::microseconds TotalTime