[lld] 9cb2bad - lld: use `std::make_unique` (NFC)
Saleem Abdulrasool via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 3 12:23:30 PDT 2020
Author: Saleem Abdulrasool
Date: 2020-06-03T19:23:13Z
New Revision: 9cb2badc596497f49ec2631bb5b8a2300656e75c
URL: https://github.com/llvm/llvm-project/commit/9cb2badc596497f49ec2631bb5b8a2300656e75c
DIFF: https://github.com/llvm/llvm-project/commit/9cb2badc596497f49ec2631bb5b8a2300656e75c.diff
LOG: lld: use `std::make_unique` (NFC)
The LLVM code base already uses C++14, use std::make_unique
to avoid the explicit constructor invocation via new and to avoid
spelling out the type twice.
Added:
Modified:
lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
Removed:
################################################################################
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
index 3347bb13508e..80a1bf00a70d 100644
--- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
+++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
@@ -1401,7 +1401,7 @@ llvm::Error parseObjCImageInfo(const Section §,
llvm::Expected<std::unique_ptr<lld::File>>
objectToAtoms(const NormalizedFile &normalizedFile, StringRef path,
bool copyRefs) {
- std::unique_ptr<MachOFile> file(new MachOFile(path));
+ auto file = std::make_unique<MachOFile>(path);
if (auto ec = normalizedObjectToAtoms(file.get(), normalizedFile, copyRefs))
return std::move(ec);
return std::unique_ptr<File>(std::move(file));
@@ -1411,7 +1411,7 @@ llvm::Expected<std::unique_ptr<lld::File>>
dylibToAtoms(const NormalizedFile &normalizedFile, StringRef path,
bool copyRefs) {
// Instantiate SharedLibraryFile object.
- std::unique_ptr<MachODylibFile> file(new MachODylibFile(path));
+ auto file = std::make_unique<MachODylibFile>(path);
if (auto ec = normalizedDylibToAtoms(file.get(), normalizedFile, copyRefs))
return std::move(ec);
return std::unique_ptr<File>(std::move(file));
More information about the llvm-commits
mailing list