From 9c366cdf2a80aeaf57cb540bdc4843bc0381cafa Mon Sep 17 00:00:00 2001 From: Nikolay Haustov Date: Tue, 28 Jun 2016 08:00:42 +0000 Subject: [Driver] Add method to redirect output of Compilation. 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 llvm-svn: 273997 --- clang/lib/Driver/Compilation.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'clang/lib/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; +} -- cgit v1.2.3