[lld] r219709 - Use llvm::make_unique.
Rui Ueyama
ruiu at google.com
Tue Oct 14 12:43:37 PDT 2014
Author: ruiu
Date: Tue Oct 14 14:43:37 2014
New Revision: 219709
URL: http://llvm.org/viewvc/llvm-project?rev=219709&view=rev
Log:
Use llvm::make_unique.
Modified:
lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
lld/trunk/lib/ReaderWriter/PECOFF/Pass.cpp
lld/trunk/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp
Modified: lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp?rev=219709&r1=219708&r2=219709&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp Tue Oct 14 14:43:37 2014
@@ -90,17 +90,15 @@ std::unique_ptr<File> PECOFFLinkingConte
bool PECOFFLinkingContext::createImplicitFiles(
std::vector<std::unique_ptr<File>> &) {
// Create a file for __ImageBase.
- std::unique_ptr<SimpleFileNode> fileNode(
- new SimpleFileNode("Implicit Files"));
- std::unique_ptr<File> linkerGeneratedSymFile(
- new pecoff::LinkerGeneratedSymbolFile(*this));
- fileNode->appendInputFile(std::move(linkerGeneratedSymFile));
+ auto fileNode = llvm::make_unique<SimpleFileNode>("Implicit Files");
+ fileNode->appendInputFile(
+ llvm::make_unique<pecoff::LinkerGeneratedSymbolFile>(*this));
getInputGraph().addInputElement(std::move(fileNode));
// Create a file for _imp_ symbols.
- std::unique_ptr<SimpleFileNode> impFileNode(new SimpleFileNode("imp"));
+ auto impFileNode = llvm::make_unique<SimpleFileNode>("imp");
impFileNode->appendInputFile(
- std::unique_ptr<File>(new pecoff::LocallyImportedSymbolFile(*this)));
+ llvm::make_unique<pecoff::LocallyImportedSymbolFile>(*this));
getInputGraph().addInputElement(std::move(impFileNode));
std::shared_ptr<pecoff::ResolvableSymbols> syms(
@@ -108,14 +106,14 @@ bool PECOFFLinkingContext::createImplici
getInputGraph().registerObserver([=](File *file) { syms->add(file); });
// Create a file for dllexported symbols.
- std::unique_ptr<SimpleFileNode> exportNode(new SimpleFileNode("<export>"));
- auto *renameFile = new pecoff::ExportedSymbolRenameFile(*this, syms);
- exportNode->appendInputFile(std::unique_ptr<File>(renameFile));
+ auto exportNode = llvm::make_unique<SimpleFileNode>("<export>");
+ exportNode->appendInputFile(
+ llvm::make_unique<pecoff::ExportedSymbolRenameFile>(*this, syms));
getLibraryGroup()->addFile(std::move(exportNode));
// Create a file for the entry point function.
getEntryNode()->appendInputFile(
- std::unique_ptr<File>(new pecoff::EntryPointFile(*this, syms)));
+ llvm::make_unique<pecoff::EntryPointFile>(*this, syms));
return true;
}
Modified: lld/trunk/lib/ReaderWriter/PECOFF/Pass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/Pass.cpp?rev=219709&r1=219708&r2=219709&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/Pass.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/Pass.cpp Tue Oct 14 14:43:37 2014
@@ -19,8 +19,8 @@ namespace pecoff {
static void addReloc(COFFBaseDefinedAtom *atom, const Atom *target,
size_t offsetInAtom, Reference::KindArch arch,
Reference::KindValue relType) {
- auto *ref = new COFFReference(target, offsetInAtom, relType, arch);
- atom->addReference(std::unique_ptr<COFFReference>(ref));
+ atom->addReference(llvm::make_unique<COFFReference>(
+ target, offsetInAtom, relType, arch));
}
void addDir32Reloc(COFFBaseDefinedAtom *atom, const Atom *target,
Modified: lld/trunk/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp?rev=219709&r1=219708&r2=219709&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp Tue Oct 14 14:43:37 2014
@@ -343,7 +343,7 @@ private:
void Registry::addSupportCOFFImportLibraries(PECOFFLinkingContext &ctx) {
MachineTypes machine = ctx.getMachineType();
- add(std::unique_ptr<Reader>(new COFFImportLibraryReader(machine)));
+ add(llvm::make_unique<COFFImportLibraryReader>(machine));
}
} // end namespace lld
More information about the llvm-commits
mailing list