mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-31 09:25:42 +00:00
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@224108 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -204,16 +204,15 @@ static const Target *GetTarget(const char *ProgName) {
|
|||||||
return TheTarget;
|
return TheTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
static tool_output_file *GetOutputStream() {
|
static std::unique_ptr<tool_output_file> GetOutputStream() {
|
||||||
if (OutputFilename == "")
|
if (OutputFilename == "")
|
||||||
OutputFilename = "-";
|
OutputFilename = "-";
|
||||||
|
|
||||||
std::error_code EC;
|
std::error_code EC;
|
||||||
tool_output_file *Out =
|
auto Out = llvm::make_unique<tool_output_file>(OutputFilename, EC,
|
||||||
new tool_output_file(OutputFilename, EC, sys::fs::F_None);
|
sys::fs::F_None);
|
||||||
if (EC) {
|
if (EC) {
|
||||||
errs() << EC.message() << '\n';
|
errs() << EC.message() << '\n';
|
||||||
delete Out;
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -435,7 +434,7 @@ int main(int argc, char **argv) {
|
|||||||
FeaturesStr = Features.getString();
|
FeaturesStr = Features.getString();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<tool_output_file> Out(GetOutputStream());
|
std::unique_ptr<tool_output_file> Out = GetOutputStream();
|
||||||
if (!Out)
|
if (!Out)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user