Use llvm::make_unique.

llvm-svn: 233319
This commit is contained in:
Rui Ueyama 2015-03-26 21:16:26 +00:00
parent aeed3cbce0
commit 8b95afa095
8 changed files with 28 additions and 31 deletions

View File

@ -29,12 +29,11 @@ void AArch64TargetHandler::registerRelocationNames(Registry &registry) {
std::unique_ptr<Writer> AArch64TargetHandler::getWriter() {
switch (this->_context.getOutputELFType()) {
case llvm::ELF::ET_EXEC:
return std::unique_ptr<Writer>(new AArch64ExecutableWriter<AArch64ELFType>(
_context, *_AArch64TargetLayout.get()));
return llvm::make_unique<AArch64ExecutableWriter<AArch64ELFType>>(
_context, *_AArch64TargetLayout.get());
case llvm::ELF::ET_DYN:
return std::unique_ptr<Writer>(
new AArch64DynamicLibraryWriter<AArch64ELFType>(
_context, *_AArch64TargetLayout.get()));
return llvm::make_unique<AArch64DynamicLibraryWriter<AArch64ELFType>>(
_context, *_AArch64TargetLayout.get());
case llvm::ELF::ET_REL:
llvm_unreachable("TODO: support -r mode");
default:

View File

@ -29,8 +29,8 @@ void ARMTargetHandler::registerRelocationNames(Registry &registry) {
std::unique_ptr<Writer> ARMTargetHandler::getWriter() {
switch (this->_context.getOutputELFType()) {
case llvm::ELF::ET_EXEC:
return std::unique_ptr<Writer>(
new ARMExecutableWriter<ARMELFType>(_context, *_armTargetLayout.get()));
return llvm::make_unique<ARMExecutableWriter<ARMELFType>>(
_context, *_armTargetLayout.get());
default:
llvm_unreachable("unsupported output type");
}

View File

@ -28,13 +28,11 @@ HexagonTargetHandler::HexagonTargetHandler(HexagonLinkingContext &context)
std::unique_ptr<Writer> HexagonTargetHandler::getWriter() {
switch (_hexagonLinkingContext.getOutputELFType()) {
case llvm::ELF::ET_EXEC:
return std::unique_ptr<Writer>(
new elf::HexagonExecutableWriter<HexagonELFType>(
_hexagonLinkingContext, *_hexagonTargetLayout.get()));
return llvm::make_unique<HexagonExecutableWriter<HexagonELFType>>(
_hexagonLinkingContext, *_hexagonTargetLayout.get());
case llvm::ELF::ET_DYN:
return std::unique_ptr<Writer>(
new elf::HexagonDynamicLibraryWriter<HexagonELFType>(
_hexagonLinkingContext, *_hexagonTargetLayout.get()));
return llvm::make_unique<HexagonDynamicLibraryWriter<HexagonELFType>>(
_hexagonLinkingContext, *_hexagonTargetLayout.get());
case llvm::ELF::ET_REL:
llvm_unreachable("TODO: support -r mode");
default:

View File

@ -116,11 +116,11 @@ public:
MipsTargetLayout<ELFT> &getTargetLayout() override { return *_targetLayout; }
std::unique_ptr<Reader> getObjReader() override {
return std::unique_ptr<Reader>(new MipsELFObjectReader<ELFT>(_ctx));
return llvm::make_unique<MipsELFObjectReader<ELFT>>(_ctx);
}
std::unique_ptr<Reader> getDSOReader() override {
return std::unique_ptr<Reader>(new MipsELFDSOReader<ELFT>(_ctx));
return llvm::make_unique<MipsELFDSOReader<ELFT>>(_ctx);
}
const TargetRelocationHandler &getRelocationHandler() const override {
@ -130,11 +130,11 @@ public:
std::unique_ptr<Writer> getWriter() override {
switch (_ctx.getOutputELFType()) {
case llvm::ELF::ET_EXEC:
return std::unique_ptr<Writer>(
new MipsExecutableWriter<ELFT>(_ctx, *_targetLayout));
return llvm::make_unique<MipsExecutableWriter<ELFT>>(
_ctx, *_targetLayout);
case llvm::ELF::ET_DYN:
return std::unique_ptr<Writer>(
new MipsDynamicLibraryWriter<ELFT>(_ctx, *_targetLayout));
return llvm::make_unique<MipsDynamicLibraryWriter<ELFT>>(
_ctx, *_targetLayout);
case llvm::ELF::ET_REL:
llvm_unreachable("TODO: support -r mode");
default:

View File

@ -21,11 +21,11 @@ using namespace llvm::ELF;
std::unique_ptr<Writer> X86TargetHandler::getWriter() {
switch (_x86LinkingContext.getOutputELFType()) {
case llvm::ELF::ET_EXEC:
return std::unique_ptr<Writer>(new X86ExecutableWriter<X86ELFType>(
_x86LinkingContext, *_x86TargetLayout.get()));
return llvm::make_unique<X86ExecutableWriter<X86ELFType>>(
_x86LinkingContext, *_x86TargetLayout.get());
case llvm::ELF::ET_DYN:
return std::unique_ptr<Writer>(new X86DynamicLibraryWriter<X86ELFType>(
_x86LinkingContext, *_x86TargetLayout.get()));
return llvm::make_unique<X86DynamicLibraryWriter<X86ELFType>>(
_x86LinkingContext, *_x86TargetLayout.get());
case llvm::ELF::ET_REL:
llvm_unreachable("TODO: support -r mode");
default:

View File

@ -42,11 +42,11 @@ public:
}
std::unique_ptr<Reader> getObjReader() override {
return std::unique_ptr<Reader>(new X86ELFObjectReader(_x86LinkingContext));
return llvm::make_unique<X86ELFObjectReader>(_x86LinkingContext);
}
std::unique_ptr<Reader> getDSOReader() override {
return std::unique_ptr<Reader>(new X86ELFDSOReader(_x86LinkingContext));
return llvm::make_unique<X86ELFDSOReader>(_x86LinkingContext);
}
std::unique_ptr<Writer> getWriter() override;

View File

@ -29,11 +29,11 @@ void X86_64TargetHandler::registerRelocationNames(Registry &registry) {
std::unique_ptr<Writer> X86_64TargetHandler::getWriter() {
switch (this->_context.getOutputELFType()) {
case llvm::ELF::ET_EXEC:
return std::unique_ptr<Writer>(
new X86_64ExecutableWriter(_context, *_x86_64TargetLayout.get()));
return llvm::make_unique<X86_64ExecutableWriter>(
_context, *_x86_64TargetLayout.get());
case llvm::ELF::ET_DYN:
return std::unique_ptr<Writer>(
new X86_64DynamicLibraryWriter(_context, *_x86_64TargetLayout.get()));
return llvm::make_unique<X86_64DynamicLibraryWriter>(
_context, *_x86_64TargetLayout.get());
case llvm::ELF::ET_REL:
llvm_unreachable("TODO: support -r mode");
default:

View File

@ -47,11 +47,11 @@ public:
}
std::unique_ptr<Reader> getObjReader() override {
return std::unique_ptr<Reader>(new X86_64ELFObjectReader(_context));
return llvm::make_unique<X86_64ELFObjectReader>(_context);
}
std::unique_ptr<Reader> getDSOReader() override {
return std::unique_ptr<Reader>(new X86_64ELFDSOReader(_context));
return llvm::make_unique<X86_64ELFDSOReader>(_context);
}
std::unique_ptr<Writer> getWriter() override;