From 11043f9faff534668f2c52b93083865f660b29db Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Thu, 11 Dec 2014 07:04:46 +0000 Subject: [PATCH] Use unique_ptr to remove an explicit delete. Change return type to pass the unique_ptr to caller. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224003 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llc/llc.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp index fe4d9ac4f19..b9de56c105d 100644 --- a/tools/llc/llc.cpp +++ b/tools/llc/llc.cpp @@ -95,9 +95,9 @@ static cl::opt 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 +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(OutputFilename, EC, + OpenFlags); if (EC) { errs() << EC.message() << '\n'; - delete FDOut; return nullptr; } -- 2.34.1