summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2019-08-14 22:28:17 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2019-08-14 22:28:17 +0000
commit6ba7992031cc803a01f0622f4899668b15a20a98 (patch)
tree64a078fe7e002dc2049b3d1cc5143af896c351f1
parent736259e3428d36f8024e6b08e4a95167f313d958 (diff)
downloadbcm5719-llvm-6ba7992031cc803a01f0622f4899668b15a20a98.tar.gz
bcm5719-llvm-6ba7992031cc803a01f0622f4899668b15a20a98.zip
[LLD] Migrate llvm::make_unique to std::make_unique
Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. Differential revision: https://reviews.llvm.org/D66259 llvm-svn: 368936
-rw-r--r--lld/COFF/LTO.cpp8
-rw-r--r--lld/COFF/PDB.cpp2
-rw-r--r--lld/ELF/InputFiles.cpp2
-rw-r--r--lld/ELF/LTO.cpp8
-rw-r--r--lld/ELF/LinkerScript.cpp4
-rw-r--r--lld/ELF/SyntheticSections.cpp2
-rw-r--r--lld/include/lld/ReaderWriter/MachOLinkingContext.h2
-rw-r--r--lld/lib/Driver/DarwinLdDriver.cpp8
-rw-r--r--lld/lib/ReaderWriter/FileArchive.cpp2
-rw-r--r--lld/lib/ReaderWriter/MachO/CompactUnwindPass.cpp2
-rw-r--r--lld/lib/ReaderWriter/MachO/GOTPass.cpp2
-rw-r--r--lld/lib/ReaderWriter/MachO/LayoutPass.cpp2
-rw-r--r--lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp6
-rw-r--r--lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp4
-rw-r--r--lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp8
-rw-r--r--lld/lib/ReaderWriter/MachO/ObjCPass.cpp2
-rw-r--r--lld/lib/ReaderWriter/MachO/ShimPass.cpp2
-rw-r--r--lld/lib/ReaderWriter/MachO/TLVPass.cpp2
-rw-r--r--lld/wasm/LTO.cpp6
19 files changed, 37 insertions, 37 deletions
diff --git a/lld/COFF/LTO.cpp b/lld/COFF/LTO.cpp
index 8e502d0cc9f..4b71dbdd2e2 100644
--- a/lld/COFF/LTO.cpp
+++ b/lld/COFF/LTO.cpp
@@ -46,7 +46,7 @@ using namespace lld::coff;
static std::unique_ptr<raw_fd_ostream> openFile(StringRef file) {
std::error_code ec;
auto ret =
- llvm::make_unique<raw_fd_ostream>(file, ec, sys::fs::OpenFlags::OF_None);
+ std::make_unique<raw_fd_ostream>(file, ec, sys::fs::OpenFlags::OF_None);
if (ec) {
error("cannot open " + file + ": " + ec.message());
return nullptr;
@@ -105,7 +105,7 @@ BitcodeCompiler::BitcodeCompiler() {
backend = lto::createInProcessThinBackend(config->thinLTOJobs);
}
- ltoObj = llvm::make_unique<lto::LTO>(createConfig(), backend,
+ ltoObj = std::make_unique<lto::LTO>(createConfig(), backend,
config->ltoPartitions);
}
@@ -160,8 +160,8 @@ std::vector<StringRef> BitcodeCompiler::compile() {
checkError(ltoObj->run(
[&](size_t task) {
- return llvm::make_unique<lto::NativeObjectStream>(
- llvm::make_unique<raw_svector_ostream>(buf[task]));
+ return std::make_unique<lto::NativeObjectStream>(
+ std::make_unique<raw_svector_ostream>(buf[task]));
},
cache));
diff --git a/lld/COFF/PDB.cpp b/lld/COFF/PDB.cpp
index a55e5136e04..1dc13532c31 100644
--- a/lld/COFF/PDB.cpp
+++ b/lld/COFF/PDB.cpp
@@ -1150,7 +1150,7 @@ void DebugSHandler::finish() {
// string table. Generally the string table subsection appears after the
// checksum table, so we have to do this after looping over all the
// subsections.
- auto newChecksums = make_unique<DebugChecksumsSubsection>(linker.pdbStrTab);
+ auto newChecksums = std::make_unique<DebugChecksumsSubsection>(linker.pdbStrTab);
for (FileChecksumEntry &fc : checksums) {
SmallString<128> filename =
exitOnErr(cVStrTab.getString(fc.FileNameOffset));
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp
index 4899edd6dc2..4d2533f5a88 100644
--- a/lld/ELF/InputFiles.cpp
+++ b/lld/ELF/InputFiles.cpp
@@ -252,7 +252,7 @@ std::string InputFile::getSrcMsg(const Symbol &sym, InputSectionBase &sec,
}
template <class ELFT> void ObjFile<ELFT>::initializeDwarf() {
- dwarf = llvm::make_unique<DWARFContext>(make_unique<LLDDwarfObj<ELFT>>(this));
+ dwarf = std::make_unique<DWARFContext>(std::make_unique<LLDDwarfObj<ELFT>>(this));
for (std::unique_ptr<DWARFUnit> &cu : dwarf->compile_units()) {
auto report = [](Error err) {
handleAllErrors(std::move(err),
diff --git a/lld/ELF/LTO.cpp b/lld/ELF/LTO.cpp
index 075a4824462..00c87fd5f48 100644
--- a/lld/ELF/LTO.cpp
+++ b/lld/ELF/LTO.cpp
@@ -50,7 +50,7 @@ using namespace lld::elf;
static std::unique_ptr<raw_fd_ostream> openFile(StringRef file) {
std::error_code ec;
auto ret =
- llvm::make_unique<raw_fd_ostream>(file, ec, sys::fs::OpenFlags::OF_None);
+ std::make_unique<raw_fd_ostream>(file, ec, sys::fs::OpenFlags::OF_None);
if (ec) {
error("cannot open " + file + ": " + ec.message());
return nullptr;
@@ -141,7 +141,7 @@ BitcodeCompiler::BitcodeCompiler() {
backend = lto::createInProcessThinBackend(config->thinLTOJobs);
}
- ltoObj = llvm::make_unique<lto::LTO>(createConfig(), backend,
+ ltoObj = std::make_unique<lto::LTO>(createConfig(), backend,
config->ltoPartitions);
// Initialize usedStartStop.
@@ -251,8 +251,8 @@ std::vector<InputFile *> BitcodeCompiler::compile() {
if (!bitcodeFiles.empty())
checkError(ltoObj->run(
[&](size_t task) {
- return llvm::make_unique<lto::NativeObjectStream>(
- llvm::make_unique<raw_svector_ostream>(buf[task]));
+ return std::make_unique<lto::NativeObjectStream>(
+ std::make_unique<raw_svector_ostream>(buf[task]));
},
cache));
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index c6f9345e739..23f385f290e 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -460,7 +460,7 @@ void LinkerScript::processSectionCommands() {
// This is needed as there are some cases where we cannot just
// thread the current state through to a lambda function created by the
// script parser.
- auto deleter = make_unique<AddressState>();
+ auto deleter = std::make_unique<AddressState>();
ctx = deleter.get();
ctx->outSec = aether;
@@ -1057,7 +1057,7 @@ static uint64_t getInitialDot() {
void LinkerScript::assignAddresses() {
dot = getInitialDot();
- auto deleter = make_unique<AddressState>();
+ auto deleter = std::make_unique<AddressState>();
ctx = deleter.get();
errorOnMissingSection = true;
switchTo(aether);
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index e8500de5d5b..50db46b1249 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -2629,7 +2629,7 @@ template <class ELFT> GdbIndexSection *GdbIndexSection::create() {
parallelForEachN(0, sections.size(), [&](size_t i) {
ObjFile<ELFT> *file = sections[i]->getFile<ELFT>();
- DWARFContext dwarf(make_unique<LLDDwarfObj<ELFT>>(file));
+ DWARFContext dwarf(std::make_unique<LLDDwarfObj<ELFT>>(file));
chunks[i].sec = sections[i];
chunks[i].compilationUnits = readCuList(dwarf);
diff --git a/lld/include/lld/ReaderWriter/MachOLinkingContext.h b/lld/include/lld/ReaderWriter/MachOLinkingContext.h
index f48ad77053e..a950fd5b18e 100644
--- a/lld/include/lld/ReaderWriter/MachOLinkingContext.h
+++ b/lld/include/lld/ReaderWriter/MachOLinkingContext.h
@@ -101,7 +101,7 @@ public:
auto file = std::unique_ptr<T>(new T(std::forward<Args>(args)...));
auto *filePtr = file.get();
auto *ctx = const_cast<MachOLinkingContext *>(this);
- ctx->getNodes().push_back(llvm::make_unique<FileNode>(std::move(file)));
+ ctx->getNodes().push_back(std::make_unique<FileNode>(std::move(file)));
return filePtr;
}
diff --git a/lld/lib/Driver/DarwinLdDriver.cpp b/lld/lib/Driver/DarwinLdDriver.cpp
index 68dc789479f..8566ababc65 100644
--- a/lld/lib/Driver/DarwinLdDriver.cpp
+++ b/lld/lib/Driver/DarwinLdDriver.cpp
@@ -95,7 +95,7 @@ public:
static std::vector<std::unique_ptr<File>>
makeErrorFile(StringRef path, std::error_code ec) {
std::vector<std::unique_ptr<File>> result;
- result.push_back(llvm::make_unique<ErrorFile>(path, ec));
+ result.push_back(std::make_unique<ErrorFile>(path, ec));
return result;
}
@@ -160,7 +160,7 @@ static void addFile(StringRef path, MachOLinkingContext &ctx,
std::vector<std::unique_ptr<File>> files =
loadFile(ctx, path, loadWholeArchive, upwardDylib);
for (std::unique_ptr<File> &file : files)
- ctx.getNodes().push_back(llvm::make_unique<FileNode>(std::move(file)));
+ ctx.getNodes().push_back(std::make_unique<FileNode>(std::move(file)));
}
// Export lists are one symbol per line. Blank lines are ignored.
@@ -1138,7 +1138,7 @@ static void createFiles(MachOLinkingContext &ctx, bool Implicit) {
ctx.createInternalFiles(Files);
for (auto i = Files.rbegin(), e = Files.rend(); i != e; ++i) {
auto &members = ctx.getNodes();
- members.insert(members.begin(), llvm::make_unique<FileNode>(std::move(*i)));
+ members.insert(members.begin(), std::make_unique<FileNode>(std::move(*i)));
}
}
@@ -1185,7 +1185,7 @@ bool link(llvm::ArrayRef<const char *> args, bool CanExitEarly,
merged = mergedFile.get();
auto &members = ctx.getNodes();
members.insert(members.begin(),
- llvm::make_unique<FileNode>(std::move(mergedFile)));
+ std::make_unique<FileNode>(std::move(mergedFile)));
}
resolveTask.end();
diff --git a/lld/lib/ReaderWriter/FileArchive.cpp b/lld/lib/ReaderWriter/FileArchive.cpp
index b09bf34dc47..98f4d06ee21 100644
--- a/lld/lib/ReaderWriter/FileArchive.cpp
+++ b/lld/lib/ReaderWriter/FileArchive.cpp
@@ -210,7 +210,7 @@ public:
const Registry &reg) const override {
StringRef path = mb->getBufferIdentifier();
std::unique_ptr<File> ret =
- llvm::make_unique<FileArchive>(std::move(mb), reg, path, _logLoading);
+ std::make_unique<FileArchive>(std::move(mb), reg, path, _logLoading);
return std::move(ret);
}
diff --git a/lld/lib/ReaderWriter/MachO/CompactUnwindPass.cpp b/lld/lib/ReaderWriter/MachO/CompactUnwindPass.cpp
index de5adb08879..44e6a29a0b6 100644
--- a/lld/lib/ReaderWriter/MachO/CompactUnwindPass.cpp
+++ b/lld/lib/ReaderWriter/MachO/CompactUnwindPass.cpp
@@ -573,7 +573,7 @@ private:
void addCompactUnwindPass(PassManager &pm, const MachOLinkingContext &ctx) {
assert(ctx.needsCompactUnwindPass());
- pm.add(llvm::make_unique<CompactUnwindPass>(ctx));
+ pm.add(std::make_unique<CompactUnwindPass>(ctx));
}
} // end namesapce mach_o
diff --git a/lld/lib/ReaderWriter/MachO/GOTPass.cpp b/lld/lib/ReaderWriter/MachO/GOTPass.cpp
index bc66d49eafb..514dd4e09da 100644
--- a/lld/lib/ReaderWriter/MachO/GOTPass.cpp
+++ b/lld/lib/ReaderWriter/MachO/GOTPass.cpp
@@ -176,7 +176,7 @@ private:
void addGOTPass(PassManager &pm, const MachOLinkingContext &ctx) {
assert(ctx.needsGOTPass());
- pm.add(llvm::make_unique<GOTPass>(ctx));
+ pm.add(std::make_unique<GOTPass>(ctx));
}
} // end namesapce mach_o
diff --git a/lld/lib/ReaderWriter/MachO/LayoutPass.cpp b/lld/lib/ReaderWriter/MachO/LayoutPass.cpp
index 2718dfcf743..8db6ffb958a 100644
--- a/lld/lib/ReaderWriter/MachO/LayoutPass.cpp
+++ b/lld/lib/ReaderWriter/MachO/LayoutPass.cpp
@@ -478,7 +478,7 @@ llvm::Error LayoutPass::perform(SimpleFile &mergedFile) {
}
void addLayoutPass(PassManager &pm, const MachOLinkingContext &ctx) {
- pm.add(llvm::make_unique<LayoutPass>(
+ pm.add(std::make_unique<LayoutPass>(
ctx.registry(), [&](const DefinedAtom * left, const DefinedAtom * right,
bool & leftBeforeRight) ->bool {
return ctx.customAtomOrderer(left, right, leftBeforeRight);
diff --git a/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp b/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
index 4cb0c6a8ae0..221d895a40d 100644
--- a/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
+++ b/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
@@ -802,9 +802,9 @@ void MachOLinkingContext::addSectCreateSection(
std::unique_ptr<MemoryBuffer> content) {
if (!_sectCreateFile) {
- auto sectCreateFile = llvm::make_unique<mach_o::SectCreateFile>();
+ auto sectCreateFile = std::make_unique<mach_o::SectCreateFile>();
_sectCreateFile = sectCreateFile.get();
- getNodes().push_back(llvm::make_unique<FileNode>(std::move(sectCreateFile)));
+ getNodes().push_back(std::make_unique<FileNode>(std::move(sectCreateFile)));
}
assert(_sectCreateFile && "sectcreate file does not exist.");
@@ -1019,7 +1019,7 @@ void MachOLinkingContext::finalizeInputFiles() {
return !isLibrary(a) && isLibrary(b);
});
size_t numLibs = std::count_if(elements.begin(), elements.end(), isLibrary);
- elements.push_back(llvm::make_unique<GroupEnd>(numLibs));
+ elements.push_back(std::make_unique<GroupEnd>(numLibs));
}
llvm::Error MachOLinkingContext::handleLoadedFile(File &file) {
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
index 38b365374f3..963f1227fa4 100644
--- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
+++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
@@ -542,7 +542,7 @@ public:
loadFile(std::unique_ptr<MemoryBuffer> mb,
const Registry &registry) const override {
std::unique_ptr<File> ret =
- llvm::make_unique<MachOFile>(std::move(mb), &_ctx);
+ std::make_unique<MachOFile>(std::move(mb), &_ctx);
return std::move(ret);
}
@@ -568,7 +568,7 @@ public:
loadFile(std::unique_ptr<MemoryBuffer> mb,
const Registry &registry) const override {
std::unique_ptr<File> ret =
- llvm::make_unique<MachODylibFile>(std::move(mb), &_ctx);
+ std::make_unique<MachODylibFile>(std::move(mb), &_ctx);
return std::move(ret);
}
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
index bcddb977b02..f34857b9967 100644
--- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
+++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
@@ -717,7 +717,7 @@ llvm::Error parseStabs(MachOFile &file,
// FIXME: Kill this off when we can move to sane yaml parsing.
std::unique_ptr<BumpPtrAllocator> allocator;
if (copyRefs)
- allocator = llvm::make_unique<BumpPtrAllocator>();
+ allocator = std::make_unique<BumpPtrAllocator>();
enum { start, inBeginEnd } state = start;
@@ -812,7 +812,7 @@ llvm::Error parseStabs(MachOFile &file,
stabsList.push_back(stab);
}
- file.setDebugInfo(llvm::make_unique<StabsDebugInfo>(std::move(stabsList)));
+ file.setDebugInfo(std::make_unique<StabsDebugInfo>(std::move(stabsList)));
// FIXME: Kill this off when we fix YAML memory ownership.
file.debugInfo()->setAllocator(std::move(allocator));
@@ -974,11 +974,11 @@ llvm::Error parseDebugInfo(MachOFile &file,
// memory ownership.
std::unique_ptr<BumpPtrAllocator> allocator;
if (copyRefs) {
- allocator = llvm::make_unique<BumpPtrAllocator>();
+ allocator = std::make_unique<BumpPtrAllocator>();
tuOrErr->name = copyDebugString(tuOrErr->name, *allocator);
tuOrErr->path = copyDebugString(tuOrErr->path, *allocator);
}
- file.setDebugInfo(llvm::make_unique<DwarfDebugInfo>(std::move(*tuOrErr)));
+ file.setDebugInfo(std::make_unique<DwarfDebugInfo>(std::move(*tuOrErr)));
if (copyRefs)
file.debugInfo()->setAllocator(std::move(allocator));
} else
diff --git a/lld/lib/ReaderWriter/MachO/ObjCPass.cpp b/lld/lib/ReaderWriter/MachO/ObjCPass.cpp
index df121f0e1d5..02a95b5aa0c 100644
--- a/lld/lib/ReaderWriter/MachO/ObjCPass.cpp
+++ b/lld/lib/ReaderWriter/MachO/ObjCPass.cpp
@@ -124,7 +124,7 @@ private:
void addObjCPass(PassManager &pm, const MachOLinkingContext &ctx) {
- pm.add(llvm::make_unique<ObjCPass>(ctx));
+ pm.add(std::make_unique<ObjCPass>(ctx));
}
} // end namespace mach_o
diff --git a/lld/lib/ReaderWriter/MachO/ShimPass.cpp b/lld/lib/ReaderWriter/MachO/ShimPass.cpp
index b0775ad5fc2..a5b34cfe8de 100644
--- a/lld/lib/ReaderWriter/MachO/ShimPass.cpp
+++ b/lld/lib/ReaderWriter/MachO/ShimPass.cpp
@@ -121,7 +121,7 @@ private:
void addShimPass(PassManager &pm, const MachOLinkingContext &ctx) {
- pm.add(llvm::make_unique<ShimPass>(ctx));
+ pm.add(std::make_unique<ShimPass>(ctx));
}
} // end namespace mach_o
diff --git a/lld/lib/ReaderWriter/MachO/TLVPass.cpp b/lld/lib/ReaderWriter/MachO/TLVPass.cpp
index 89b655e1f88..5f457b863d9 100644
--- a/lld/lib/ReaderWriter/MachO/TLVPass.cpp
+++ b/lld/lib/ReaderWriter/MachO/TLVPass.cpp
@@ -133,7 +133,7 @@ private:
void addTLVPass(PassManager &pm, const MachOLinkingContext &ctx) {
assert(ctx.needsTLVPass());
- pm.add(llvm::make_unique<TLVPass>(ctx));
+ pm.add(std::make_unique<TLVPass>(ctx));
}
} // end namesapce mach_o
diff --git a/lld/wasm/LTO.cpp b/lld/wasm/LTO.cpp
index fa48f4db7fd..afefaaeddcf 100644
--- a/lld/wasm/LTO.cpp
+++ b/lld/wasm/LTO.cpp
@@ -67,7 +67,7 @@ static std::unique_ptr<lto::LTO> createLTO() {
lto::ThinBackend backend;
if (config->thinLTOJobs != -1U)
backend = lto::createInProcessThinBackend(config->thinLTOJobs);
- return llvm::make_unique<lto::LTO>(std::move(c), backend,
+ return std::make_unique<lto::LTO>(std::move(c), backend,
config->ltoPartitions);
}
@@ -137,8 +137,8 @@ std::vector<StringRef> BitcodeCompiler::compile() {
checkError(ltoObj->run(
[&](size_t task) {
- return llvm::make_unique<lto::NativeObjectStream>(
- llvm::make_unique<raw_svector_ostream>(buf[task]));
+ return std::make_unique<lto::NativeObjectStream>(
+ std::make_unique<raw_svector_ostream>(buf[task]));
},
cache));
OpenPOWER on IntegriCloud