r234538 - Propagate usage of std:unique_ptr a bit. NFC.
Rafael Espindola
rafael.espindola at gmail.com
Thu Apr 9 14:50:11 PDT 2015
Author: rafael
Date: Thu Apr 9 16:50:11 2015
New Revision: 234538
URL: http://llvm.org/viewvc/llvm-project?rev=234538&view=rev
Log:
Propagate usage of std:unique_ptr a bit. NFC.
Modified:
cfe/trunk/tools/driver/cc1as_main.cpp
Modified: cfe/trunk/tools/driver/cc1as_main.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1as_main.cpp?rev=234538&r1=234537&r2=234538&view=diff
==============================================================================
--- cfe/trunk/tools/driver/cc1as_main.cpp (original)
+++ cfe/trunk/tools/driver/cc1as_main.cpp Thu Apr 9 16:50:11 2015
@@ -255,8 +255,9 @@ bool AssemblerInvocation::CreateFromArgs
return Success;
}
-static raw_ostream *GetOutputStream(AssemblerInvocation &Opts,
- DiagnosticsEngine &Diags, bool Binary) {
+static std::unique_ptr<raw_fd_ostream>
+getOutputStream(AssemblerInvocation &Opts, DiagnosticsEngine &Diags,
+ bool Binary) {
if (Opts.OutputPath.empty())
Opts.OutputPath = "-";
@@ -266,12 +267,11 @@ static raw_ostream *GetOutputStream(Asse
sys::RemoveFileOnSignal(Opts.OutputPath);
std::error_code EC;
- raw_fd_ostream *Out = new raw_fd_ostream(
+ auto Out = llvm::make_unique<raw_fd_ostream>(
Opts.OutputPath, EC, (Binary ? sys::fs::F_None : sys::fs::F_Text));
if (EC) {
Diags.Report(diag::err_fe_unable_to_open_output) << Opts.OutputPath
<< EC.message();
- delete Out;
return nullptr;
}
@@ -315,7 +315,7 @@ static bool ExecuteAssembler(AssemblerIn
MAI->setCompressDebugSections(true);
bool IsBinary = Opts.OutputType == AssemblerInvocation::FT_Obj;
- std::unique_ptr<raw_ostream> Out(GetOutputStream(Opts, Diags, IsBinary));
+ std::unique_ptr<raw_fd_ostream> Out = getOutputStream(Opts, Diags, IsBinary);
if (!Out)
return true;
More information about the cfe-commits
mailing list