diff options
-rw-r--r-- | clang/include/clang/Driver/Compilation.h | 9 | ||||
-rw-r--r-- | clang/lib/Driver/Compilation.cpp | 5 |
2 files changed, 14 insertions, 0 deletions
diff --git a/clang/include/clang/Driver/Compilation.h b/clang/include/clang/Driver/Compilation.h index af5440d5536..ea84a93cf28 100644 --- a/clang/include/clang/Driver/Compilation.h +++ b/clang/include/clang/Driver/Compilation.h @@ -252,6 +252,15 @@ public: /// Return true if we're compiling for diagnostics. bool isForDiagnostics() const { return ForDiagnostics; } + + /// Redirect - Redirect output of this compilation. Can only be done once. + /// + /// \param Redirects - array of pointers to paths. The array + /// should have a size of three. The inferior process's + /// stdin(0), stdout(1), and stderr(2) will be redirected to the + /// corresponding paths. This compilation instance becomes + /// the owner of Redirects and will delete the array and StringRef's. + void Redirect(const StringRef** Redirects); }; } // end namespace driver diff --git a/clang/lib/Driver/Compilation.cpp b/clang/lib/Driver/Compilation.cpp index 46548e638a3..6a2616f0c2a 100644 --- a/clang/lib/Driver/Compilation.cpp +++ b/clang/lib/Driver/Compilation.cpp @@ -45,6 +45,7 @@ Compilation::~Compilation() { // Free redirections of stdout/stderr. if (Redirects) { + delete Redirects[0]; delete Redirects[1]; delete Redirects[2]; delete [] Redirects; @@ -213,3 +214,7 @@ void Compilation::initCompilationForDiagnostics() { StringRef Compilation::getSysRoot() const { return getDriver().SysRoot; } + +void Compilation::Redirect(const StringRef** Redirects) { + this->Redirects = Redirects; +} |