aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/clang/include/clang/Driver/Job.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/clang/include/clang/Driver/Job.h')
-rw-r--r--contrib/llvm-project/clang/include/clang/Driver/Job.h49
1 files changed, 25 insertions, 24 deletions
diff --git a/contrib/llvm-project/clang/include/clang/Driver/Job.h b/contrib/llvm-project/clang/include/clang/Driver/Job.h
index 8b287638a271..df9449463c53 100644
--- a/contrib/llvm-project/clang/include/clang/Driver/Job.h
+++ b/contrib/llvm-project/clang/include/clang/Driver/Job.h
@@ -12,13 +12,13 @@
#include "clang/Basic/LLVM.h"
#include "clang/Driver/InputInfo.h"
#include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/iterator.h"
#include "llvm/Option/Option.h"
#include "llvm/Support/Program.h"
#include <memory>
+#include <optional>
#include <string>
#include <utility>
#include <vector>
@@ -116,6 +116,9 @@ class Command {
/// The executable to run.
const char *Executable;
+ /// Optional argument to prepend.
+ const char *PrependArg;
+
/// The list of program arguments (not including the implicit first
/// argument, which will be the executable).
llvm::opt::ArgStringList Arguments;
@@ -141,8 +144,11 @@ class Command {
/// See Command::setEnvironment
std::vector<const char *> Environment;
+ /// Optional redirection for stdin, stdout, stderr.
+ std::vector<std::optional<std::string>> RedirectFiles;
+
/// Information on executable run provided by OS.
- mutable Optional<llvm::sys::ProcessStatistics> ProcStat;
+ mutable std::optional<llvm::sys::ProcessStatistics> ProcStat;
/// When a response file is needed, we try to put most arguments in an
/// exclusive file, while others remains as regular command line arguments.
@@ -166,7 +172,8 @@ public:
Command(const Action &Source, const Tool &Creator,
ResponseFileSupport ResponseSupport, const char *Executable,
const llvm::opt::ArgStringList &Arguments, ArrayRef<InputInfo> Inputs,
- ArrayRef<InputInfo> Outputs = None);
+ ArrayRef<InputInfo> Outputs = std::nullopt,
+ const char *PrependArg = nullptr);
// FIXME: This really shouldn't be copyable, but is currently copied in some
// error handling in Driver::generateCompilationDiagnostics.
Command(const Command &) = default;
@@ -175,7 +182,7 @@ public:
virtual void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote,
CrashReportInfo *CrashInfo = nullptr) const;
- virtual int Execute(ArrayRef<Optional<StringRef>> Redirects,
+ virtual int Execute(ArrayRef<std::optional<StringRef>> Redirects,
std::string *ErrMsg, bool *ExecutionFailed) const;
/// getSource - Return the Action which caused the creation of this job.
@@ -204,6 +211,15 @@ public:
/// from the parent process will be used.
virtual void setEnvironment(llvm::ArrayRef<const char *> NewEnvironment);
+ void
+ setRedirectFiles(const std::vector<std::optional<std::string>> &Redirects);
+
+ void replaceArguments(llvm::opt::ArgStringList List) {
+ Arguments = std::move(List);
+ }
+
+ void replaceExecutable(const char *Exe) { Executable = Exe; }
+
const char *getExecutable() const { return Executable; }
const llvm::opt::ArgStringList &getArguments() const { return Arguments; }
@@ -214,7 +230,7 @@ public:
return OutputFilenames;
}
- Optional<llvm::sys::ProcessStatistics> getProcessStatistics() const {
+ std::optional<llvm::sys::ProcessStatistics> getProcessStatistics() const {
return ProcStat;
}
@@ -229,34 +245,19 @@ public:
CC1Command(const Action &Source, const Tool &Creator,
ResponseFileSupport ResponseSupport, const char *Executable,
const llvm::opt::ArgStringList &Arguments,
- ArrayRef<InputInfo> Inputs, ArrayRef<InputInfo> Outputs = None);
+ ArrayRef<InputInfo> Inputs,
+ ArrayRef<InputInfo> Outputs = std::nullopt,
+ const char *PrependArg = nullptr);
void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote,
CrashReportInfo *CrashInfo = nullptr) const override;
- int Execute(ArrayRef<Optional<StringRef>> Redirects, std::string *ErrMsg,
+ int Execute(ArrayRef<std::optional<StringRef>> Redirects, std::string *ErrMsg,
bool *ExecutionFailed) const override;
void setEnvironment(llvm::ArrayRef<const char *> NewEnvironment) override;
};
-/// Like Command, but always pretends that the wrapped command succeeded.
-class ForceSuccessCommand : public Command {
-public:
- ForceSuccessCommand(const Action &Source_, const Tool &Creator_,
- ResponseFileSupport ResponseSupport,
- const char *Executable_,
- const llvm::opt::ArgStringList &Arguments_,
- ArrayRef<InputInfo> Inputs,
- ArrayRef<InputInfo> Outputs = None);
-
- void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote,
- CrashReportInfo *CrashInfo = nullptr) const override;
-
- int Execute(ArrayRef<Optional<StringRef>> Redirects, std::string *ErrMsg,
- bool *ExecutionFailed) const override;
-};
-
/// JobList - A sequence of jobs to perform.
class JobList {
public: