From: Saleem Abdulrasool Date: Wed, 3 Jun 2020 18:13:05 +0000 (+0000) Subject: lld: use `std::make_unique` (NFC) X-Git-Tag: llvmorg-12-init~4247 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9cb2badc596497f49ec2631bb5b8a2300656e75c;p=platform%2Fupstream%2Fllvm.git 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. --- diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp index 3347bb1..80a1bf0 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> objectToAtoms(const NormalizedFile &normalizedFile, StringRef path, bool copyRefs) { - std::unique_ptr file(new MachOFile(path)); + auto file = std::make_unique(path); if (auto ec = normalizedObjectToAtoms(file.get(), normalizedFile, copyRefs)) return std::move(ec); return std::unique_ptr(std::move(file)); @@ -1411,7 +1411,7 @@ llvm::Expected> dylibToAtoms(const NormalizedFile &normalizedFile, StringRef path, bool copyRefs) { // Instantiate SharedLibraryFile object. - std::unique_ptr file(new MachODylibFile(path)); + auto file = std::make_unique(path); if (auto ec = normalizedDylibToAtoms(file.get(), normalizedFile, copyRefs)) return std::move(ec); return std::unique_ptr(std::move(file));