13#ifndef LLVM_SUPPORT_PROGRAM_H
14#define LLVM_SUPPORT_PROGRAM_H
18#include "llvm/Config/llvm-config.h"
24#include <system_error>
32#if defined(LLVM_ON_UNIX)
116 ArrayRef<std::optional<StringRef>> Redirects = {},
124 unsigned SecondsToWait = 0,
129 unsigned MemoryLimit = 0,
133 std::string *ErrMsg =
nullptr,
137 bool *ExecutionFailed =
nullptr,
138 std::optional<ProcessStatistics> *ProcStat =
nullptr,
153 ArrayRef<std::optional<StringRef>> Redirects = {},
unsigned MemoryLimit = 0,
154 std::string *ErrMsg =
nullptr,
bool *ExecutionFailed =
nullptr,
155 BitVector *AffinityMask =
nullptr,
159 bool DetachProcess =
false);
214 std::optional<unsigned> SecondsToWait,
223 std::string *ErrMsg =
nullptr,
227 std::optional<ProcessStatistics> *ProcStat =
Provides ErrorOr<T> smart pointer.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Represents either an error or a value T.
StringRef - Represent a constant reference to a string, i.e.
This class implements an extremely fast bulk output stream that can only output to a stream.
LLVM_ABI std::error_code ChangeStdoutMode(fs::OpenFlags Flags)
LLVM_ABI void printArg(llvm::raw_ostream &OS, StringRef Arg, bool Quote)
Print a command argument, and optionally quote it.
LLVM_ABI std::error_code ChangeStdinMode(fs::OpenFlags Flags)
LLVM_ABI std::error_code ChangeStdinToBinary()
LLVM_ABI bool commandLineFitsWithinSystemLimits(StringRef Program, ArrayRef< StringRef > Args)
Return true if the given arguments fit within system-specific argument length limits.
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.
const char EnvPathSeparator
This is the OS-specific separator for PATH like environment variables:
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 ErrorOr< std::string > findProgramByName(StringRef Name, ArrayRef< StringRef > Paths={})
Find the first executable file Name in Paths.
WindowsEncodingMethod
File encoding options when writing contents that a non-UTF8 tool will read (on Windows systems).
@ WEM_UTF8
UTF-8 is the LLVM native encoding, being the same as "do not perform encoding conversion".
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 std::error_code ChangeStdoutToBinary()
This is an optimization pass for GlobalISel generic memory operations.
This struct encapsulates information about a process.
process_t Process
The process identifier.
int ReturnCode
Platform-dependent process object.
This struct encapsulates information about a process execution.
uint64_t PeakMemory
Maximum resident set size in KiB.
std::chrono::microseconds TotalTime
std::chrono::microseconds UserTime