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)
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,
152 ArrayRef<std::optional<StringRef>> Redirects = {},
153 unsigned MemoryLimit = 0, std::string *ErrMsg =
nullptr,
154 bool *ExecutionFailed =
nullptr, BitVector *AffinityMask =
nullptr,
158 bool DetachProcess =
false);
213 std::optional<unsigned> SecondsToWait,
222 std::string *ErrMsg =
nullptr,
226 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.
std::error_code ChangeStdinMode(fs::OpenFlags Flags)
void printArg(llvm::raw_ostream &OS, StringRef Arg, bool Quote)
Print a command argument, and optionally quote it.
std::error_code ChangeStdinToBinary()
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:
bool commandLineFitsWithinSystemLimits(StringRef Program, ArrayRef< StringRef > Args)
Return true if the given arguments fit within system-specific argument length limits.
std::error_code ChangeStdoutMode(fs::OpenFlags Flags)
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".
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.
std::error_code ChangeStdoutToBinary()
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.
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.
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