Summary:
Currently output of child process, however in my use case, it
needs to be captured and presented to the user.
Add Redirect method to Compilation and use existing infrastructure
for redirecting output of commands.
Reviewers: tstellarAMD
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D21224
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@273997
91177308-0d34-0410-b5e6-
96231b3b80d8
/// 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
// Free redirections of stdout/stderr.
if (Redirects) {
+ delete Redirects[0];
delete Redirects[1];
delete Redirects[2];
delete [] Redirects;
StringRef Compilation::getSysRoot() const {
return getDriver().SysRoot;
}
+
+void Compilation::Redirect(const StringRef** Redirects) {
+ this->Redirects = Redirects;
+}