diff options
| author | Benjamin Segovia <devnull@localhost> | 2012-06-12 18:34:25 +0000 |
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2012-08-10 16:18:28 -0700 |
| commit | 8b40191eda9bc7de918daf01f54c6a08d0f3b543 (patch) | |
| tree | 3c29695ea96aed6b16a242260fab54a7c8ec0355 /backend/src/llvm/llvm_to_gen.cpp | |
| parent | 645e55a0ac148344ee7e7c5e57f1b8d3b95b4eb5 (diff) | |
Cleaned up the code to enable the blob compilation path
Diffstat (limited to 'backend/src/llvm/llvm_to_gen.cpp')
| -rw-r--r-- | backend/src/llvm/llvm_to_gen.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/backend/src/llvm/llvm_to_gen.cpp b/backend/src/llvm/llvm_to_gen.cpp index 0759f46f..a41f4a58 100644 --- a/backend/src/llvm/llvm_to_gen.cpp +++ b/backend/src/llvm/llvm_to_gen.cpp @@ -39,6 +39,7 @@ #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> +#include <memory> namespace gbe { @@ -52,7 +53,7 @@ namespace gbe // Get the global LLVM context llvm::LLVMContext& c = llvm::getGlobalContext(); std::string errInfo; - auto *o = new llvm::raw_fd_ostream("-", errInfo); + std::unique_ptr<llvm::raw_fd_ostream> o(new llvm::raw_fd_ostream("-", errInfo)); // Get the module from its file SMDiagnostic Err; @@ -65,7 +66,7 @@ namespace gbe // Print the code before further optimizations if (OCL_OUTPUT_LLVM_BEFORE_EXTRA_PASS) - passes.add(createPrintModulePass(o)); + passes.add(createPrintModulePass(&*o)); passes.add(createScalarReplAggregatesPass()); // Break up allocas passes.add(createRemoveGEPPass(unit)); passes.add(createConstantPropagationPass()); @@ -77,11 +78,11 @@ namespace gbe // Print the code extra optimization passes if (OCL_OUTPUT_LLVM) - passes.add(createPrintModulePass(o)); + passes.add(createPrintModulePass(&*o)); passes.run(mod); // raw_fd_ostream closes stdout. We must reopen it - delete o; + o = NULL; int fd; fd = open("/dev/tty", O_WRONLY); stdout = fdopen(fd, "w"); |
