lld: use `std::make_unique` (NFC)
authorSaleem Abdulrasool <compnerd@compnerd.org>
Wed, 3 Jun 2020 18:13:05 +0000 (18:13 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Wed, 3 Jun 2020 19:23:13 +0000 (19:23 +0000)
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.

lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp

index 3347bb1..80a1bf0 100644 (file)
@@ -1401,7 +1401,7 @@ llvm::Error parseObjCImageInfo(const Section &sect,
 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));