diff options
| author | Craig Topper <craig.topper@gmail.com> | 2014-12-11 07:04:46 +0000 |
|---|---|---|
| committer | Craig Topper <craig.topper@gmail.com> | 2014-12-11 07:04:46 +0000 |
| commit | ff55ffacab59ef45c4b88eea1bcdaea0a4780a7a (patch) | |
| tree | 0ddc78e953484f23aa530b4fd57add3c4e2b8abf | |
| parent | 6ec9edf8eec6a8af968a5953a7d8b98ba960b961 (diff) | |
| download | bcm5719-llvm-ff55ffacab59ef45c4b88eea1bcdaea0a4780a7a.tar.gz bcm5719-llvm-ff55ffacab59ef45c4b88eea1bcdaea0a4780a7a.zip | |
Use unique_ptr to remove an explicit delete. Change return type to pass the unique_ptr to caller.
llvm-svn: 224003
| -rw-r--r-- | llvm/tools/llc/llc.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/tools/llc/llc.cpp b/llvm/tools/llc/llc.cpp index fe4d9ac4f19..b9de56c105d 100644 --- a/llvm/tools/llc/llc.cpp +++ b/llvm/tools/llc/llc.cpp @@ -95,9 +95,9 @@ static cl::opt<bool> AsmVerbose("asm-verbose", static int compileModule(char **, LLVMContext &); -static tool_output_file *GetOutputStream(const char *TargetName, - Triple::OSType OS, - const char *ProgName) { +static std::unique_ptr<tool_output_file> +GetOutputStream(const char *TargetName, Triple::OSType OS, + const char *ProgName) { // If we don't yet have an output filename, make one. if (OutputFilename.empty()) { if (InputFilename == "-") @@ -151,10 +151,10 @@ static tool_output_file *GetOutputStream(const char *TargetName, sys::fs::OpenFlags OpenFlags = sys::fs::F_None; if (!Binary) OpenFlags |= sys::fs::F_Text; - tool_output_file *FDOut = new tool_output_file(OutputFilename, EC, OpenFlags); + auto FDOut = llvm::make_unique<tool_output_file>(OutputFilename, EC, + OpenFlags); if (EC) { errs() << EC.message() << '\n'; - delete FDOut; return nullptr; } |

