15#include "llvm/Config/llvm-config.h"
28 ArrayRef<std::optional<StringRef>> Redirects,
29 unsigned MemoryLimit, std::string *ErrMsg,
30 BitVector *AffinityMask,
bool DetachProcess);
34 ArrayRef<std::optional<StringRef>> Redirects,
35 unsigned SecondsToWait,
unsigned MemoryLimit,
36 std::string *ErrMsg,
bool *ExecutionFailed,
37 std::optional<ProcessStatistics> *ProcStat,
39 assert(Redirects.empty() || Redirects.size() == 3);
41 if (
Execute(PI, Program, Args, Env, Redirects, MemoryLimit, ErrMsg,
42 AffinityMask,
false)) {
44 *ExecutionFailed =
false;
46 PI, SecondsToWait == 0 ? std::nullopt : std::optional(SecondsToWait),
48 return Result.ReturnCode;
52 *ExecutionFailed =
true;
59 ArrayRef<std::optional<StringRef>> Redirects,
60 unsigned MemoryLimit, std::string *ErrMsg,
61 bool *ExecutionFailed,
BitVector *AffinityMask,
63 assert(Redirects.empty() || Redirects.size() == 3);
66 *ExecutionFailed =
false;
67 if (!
Execute(PI, Program, Args, Env, Redirects, MemoryLimit, ErrMsg,
68 AffinityMask, DetachProcess))
70 *ExecutionFailed =
true;
84 if (!Quote && !Escape) {
91 for (
const auto c : Arg) {
92 if (c ==
'"' || c ==
'\\' || c ==
'$')
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static bool Execute(ProcessInfo &PI, StringRef Program, ArrayRef< StringRef > Args, std::optional< ArrayRef< StringRef > > Env, ArrayRef< std::optional< StringRef > > Redirects, unsigned MemoryLimit, std::string *ErrMsg, BitVector *AffinityMask, bool DetachProcess)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
size_t find_first_of(char C, size_t From=0) const
Find the first character in the string that is C, or npos if not found.
static constexpr size_t npos
This class implements an extremely fast bulk output stream that can only output to a stream.
LLVM_ABI void printArg(llvm::raw_ostream &OS, StringRef Arg, bool Quote)
Print a command argument, and optionally quote it.
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.
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.
This is an optimization pass for GlobalISel generic memory operations.
This struct encapsulates information about a process.