[Beignet] [PATCH] make raw_fd_ostream not close stdout
Homer Hsing
homer.xing at intel.com
Mon Apr 15 20:12:01 PDT 2013
stdout was closed by llvm::raw_fd_ostream.
Now let llvm::raw_fd_ostream not close stdout.
Signed-off-by: Homer Hsing <homer.xing at intel.com>
---
backend/src/llvm/llvm_to_gen.cpp | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/backend/src/llvm/llvm_to_gen.cpp b/backend/src/llvm/llvm_to_gen.cpp
index 21193a5..ea3d9eb 100644
--- a/backend/src/llvm/llvm_to_gen.cpp
+++ b/backend/src/llvm/llvm_to_gen.cpp
@@ -55,7 +55,7 @@ namespace gbe
std::string errInfo;
std::unique_ptr<llvm::raw_fd_ostream> o = NULL;
if (OCL_OUTPUT_LLVM_BEFORE_EXTRA_PASS || OCL_OUTPUT_LLVM)
- o = std::unique_ptr<llvm::raw_fd_ostream>(new llvm::raw_fd_ostream("-", errInfo));
+ o = std::unique_ptr<llvm::raw_fd_ostream>(new llvm::raw_fd_ostream(fileno(stdout), false));
// Get the module from its file
SMDiagnostic Err;
@@ -83,13 +83,6 @@ namespace gbe
passes.add(createPrintModulePass(&*o));
passes.run(mod);
- // raw_fd_ostream closes stdout. We must reopen it
- if (OCL_OUTPUT_LLVM_BEFORE_EXTRA_PASS || OCL_OUTPUT_LLVM) {
- o = NULL;
- const int fd = open("/dev/tty", O_WRONLY);
- stdout = fdopen(fd, "w");
- }
-
return true;
}
} /* namespace gbe */
--
1.8.1.2
More information about the Beignet
mailing list