Skip to content

Commit

Permalink
Use unique_ptr to remove an explicit delete. Change return type to pa…
Browse files Browse the repository at this point in the history
…ss the unique_ptr to caller.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224003 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
topperc committed Dec 11, 2014
1 parent 8f61616 commit 11043f9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tools/llc/llc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 == "-")
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 11043f9

Please sign in to comment.