Re: [PATCH] D21224: [Driver] Add method to redirect output of Compilation.
This revision was automatically updated to reflect the committed changes. Closed by commit rL273997: [Driver] Add method to redirect output of Compilation. (authored by nhaustov). Changed prior to commit: http://reviews.llvm.org/D21224?vs=60333=62066#toc Repository: rL LLVM http://reviews.llvm.org/D21224 Files: cfe/trunk/include/clang/Driver/Compilation.h cfe/trunk/lib/Driver/Compilation.cpp Index: cfe/trunk/include/clang/Driver/Compilation.h === --- cfe/trunk/include/clang/Driver/Compilation.h +++ cfe/trunk/include/clang/Driver/Compilation.h @@ -252,6 +252,15 @@ /// 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 Index: cfe/trunk/lib/Driver/Compilation.cpp === --- cfe/trunk/lib/Driver/Compilation.cpp +++ cfe/trunk/lib/Driver/Compilation.cpp @@ -45,6 +45,7 @@ // Free redirections of stdout/stderr. if (Redirects) { +delete Redirects[0]; delete Redirects[1]; delete Redirects[2]; delete [] Redirects; @@ -213,3 +214,7 @@ StringRef Compilation::getSysRoot() const { return getDriver().SysRoot; } + +void Compilation::Redirect(const StringRef** Redirects) { + this->Redirects = Redirects; +} Index: cfe/trunk/include/clang/Driver/Compilation.h === --- cfe/trunk/include/clang/Driver/Compilation.h +++ cfe/trunk/include/clang/Driver/Compilation.h @@ -252,6 +252,15 @@ /// 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 Index: cfe/trunk/lib/Driver/Compilation.cpp === --- cfe/trunk/lib/Driver/Compilation.cpp +++ cfe/trunk/lib/Driver/Compilation.cpp @@ -45,6 +45,7 @@ // Free redirections of stdout/stderr. if (Redirects) { +delete Redirects[0]; delete Redirects[1]; delete Redirects[2]; delete [] Redirects; @@ -213,3 +214,7 @@ StringRef Compilation::getSysRoot() const { return getDriver().SysRoot; } + +void Compilation::Redirect(const StringRef** Redirects) { + this->Redirects = Redirects; +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D21224: [Driver] Add method to redirect output of Compilation.
nhaustov added a comment. Ping. http://reviews.llvm.org/D21224 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D21224: [Driver] Add method to redirect output of Compilation.
nhaustov updated this revision to Diff 60333. nhaustov updated the summary for this revision. nhaustov added a comment. Fix summary. http://reviews.llvm.org/D21224 Files: include/clang/Driver/Compilation.h lib/Driver/Compilation.cpp Index: lib/Driver/Compilation.cpp === --- lib/Driver/Compilation.cpp +++ lib/Driver/Compilation.cpp @@ -42,6 +42,7 @@ // Free redirections of stdout/stderr. if (Redirects) { +delete Redirects[0]; delete Redirects[1]; delete Redirects[2]; delete [] Redirects; @@ -210,3 +211,7 @@ StringRef Compilation::getSysRoot() const { return getDriver().SysRoot; } + +void Compilation::Redirect(const StringRef** Redirects) { + this->Redirects = Redirects; +} Index: include/clang/Driver/Compilation.h === --- include/clang/Driver/Compilation.h +++ include/clang/Driver/Compilation.h @@ -208,6 +208,15 @@ /// Return true if we're compiling for diagnostics. bool isForDiagnostics() const { return ForDiagnostics; } + + /// RedirectOutput - 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 Index: lib/Driver/Compilation.cpp === --- lib/Driver/Compilation.cpp +++ lib/Driver/Compilation.cpp @@ -42,6 +42,7 @@ // Free redirections of stdout/stderr. if (Redirects) { +delete Redirects[0]; delete Redirects[1]; delete Redirects[2]; delete [] Redirects; @@ -210,3 +211,7 @@ StringRef Compilation::getSysRoot() const { return getDriver().SysRoot; } + +void Compilation::Redirect(const StringRef** Redirects) { + this->Redirects = Redirects; +} Index: include/clang/Driver/Compilation.h === --- include/clang/Driver/Compilation.h +++ include/clang/Driver/Compilation.h @@ -208,6 +208,15 @@ /// Return true if we're compiling for diagnostics. bool isForDiagnostics() const { return ForDiagnostics; } + + /// RedirectOutput - 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 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D21224: [Driver] Add method to redirect output of Compilation.
nhaustov created this revision. nhaustov added a reviewer: tstellarAMD. nhaustov added a subscriber: cfe-commits. 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. http://reviews.llvm.org/D21224 Files: include/clang/Driver/Compilation.h lib/Driver/Compilation.cpp Index: lib/Driver/Compilation.cpp === --- lib/Driver/Compilation.cpp +++ lib/Driver/Compilation.cpp @@ -42,6 +42,7 @@ // Free redirections of stdout/stderr. if (Redirects) { +delete Redirects[0]; delete Redirects[1]; delete Redirects[2]; delete [] Redirects; @@ -210,3 +211,7 @@ StringRef Compilation::getSysRoot() const { return getDriver().SysRoot; } + +void Compilation::Redirect(const StringRef** Redirects) { + this->Redirects = Redirects; +} Index: include/clang/Driver/Compilation.h === --- include/clang/Driver/Compilation.h +++ include/clang/Driver/Compilation.h @@ -208,6 +208,15 @@ /// Return true if we're compiling for diagnostics. bool isForDiagnostics() const { return ForDiagnostics; } + + /// RedirectOutput - 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 Index: lib/Driver/Compilation.cpp === --- lib/Driver/Compilation.cpp +++ lib/Driver/Compilation.cpp @@ -42,6 +42,7 @@ // Free redirections of stdout/stderr. if (Redirects) { +delete Redirects[0]; delete Redirects[1]; delete Redirects[2]; delete [] Redirects; @@ -210,3 +211,7 @@ StringRef Compilation::getSysRoot() const { return getDriver().SysRoot; } + +void Compilation::Redirect(const StringRef** Redirects) { + this->Redirects = Redirects; +} Index: include/clang/Driver/Compilation.h === --- include/clang/Driver/Compilation.h +++ include/clang/Driver/Compilation.h @@ -208,6 +208,15 @@ /// Return true if we're compiling for diagnostics. bool isForDiagnostics() const { return ForDiagnostics; } + + /// RedirectOutput - 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 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits