Skip to content

Commit 9cb2bad

Browse files
committed
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.
1 parent 2e4c5d1 commit 9cb2bad

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,7 +1401,7 @@ llvm::Error parseObjCImageInfo(const Section &sect,
14011401
llvm::Expected<std::unique_ptr<lld::File>>
14021402
objectToAtoms(const NormalizedFile &normalizedFile, StringRef path,
14031403
bool copyRefs) {
1404-
std::unique_ptr<MachOFile> file(new MachOFile(path));
1404+
auto file = std::make_unique<MachOFile>(path);
14051405
if (auto ec = normalizedObjectToAtoms(file.get(), normalizedFile, copyRefs))
14061406
return std::move(ec);
14071407
return std::unique_ptr<File>(std::move(file));
@@ -1411,7 +1411,7 @@ llvm::Expected<std::unique_ptr<lld::File>>
14111411
dylibToAtoms(const NormalizedFile &normalizedFile, StringRef path,
14121412
bool copyRefs) {
14131413
// Instantiate SharedLibraryFile object.
1414-
std::unique_ptr<MachODylibFile> file(new MachODylibFile(path));
1414+
auto file = std::make_unique<MachODylibFile>(path);
14151415
if (auto ec = normalizedDylibToAtoms(file.get(), normalizedFile, copyRefs))
14161416
return std::move(ec);
14171417
return std::unique_ptr<File>(std::move(file));

0 commit comments

Comments
 (0)