[lld] r231756 - Use template aliases.
Rui Ueyama
ruiu at google.com
Mon Mar 9 22:14:24 PDT 2015
Author: ruiu
Date: Tue Mar 10 00:14:24 2015
New Revision: 231756
URL: http://llvm.org/viewvc/llvm-project?rev=231756&view=rev
Log:
Use template aliases.
We dropped Visual Studio 2012 support, so we can use template aliases.
Modified:
lld/trunk/include/lld/Core/STDExtras.h
lld/trunk/lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h
lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h
lld/trunk/lib/ReaderWriter/ELF/ExecutableWriter.h
lld/trunk/lib/ReaderWriter/ELF/Mips/MipsDynamicLibraryWriter.h
lld/trunk/lib/ReaderWriter/ELF/Mips/MipsExecutableWriter.h
lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h
Modified: lld/trunk/include/lld/Core/STDExtras.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/STDExtras.h?rev=231756&r1=231755&r2=231756&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/STDExtras.h (original)
+++ lld/trunk/include/lld/Core/STDExtras.h Tue Mar 10 00:14:24 2015
@@ -21,12 +21,8 @@ struct destruct_delete {
}
};
-// Sadly VS 2012 doesn't support template aliases.
-// template <class T>
-// using unique_bump_ptr = std::unique_ptr<T, destruct_delete<T>>;
-
-#define LLD_UNIQUE_BUMP_PTR(...) \
- std::unique_ptr<__VA_ARGS__, destruct_delete<__VA_ARGS__>>
+template <class T>
+using unique_bump_ptr = std::unique_ptr<T, destruct_delete<T>>;
} // end namespace lld
Modified: lld/trunk/lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h?rev=231756&r1=231755&r2=231756&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h Tue Mar 10 00:14:24 2015
@@ -37,7 +37,7 @@ protected:
}
/// \brief Create symbol table.
- LLD_UNIQUE_BUMP_PTR(SymbolTable<ELFT>) createSymbolTable() override;
+ unique_bump_ptr<SymbolTable<ELFT>> createSymbolTable() override;
private:
ARMLinkingContext &_context;
@@ -58,9 +58,9 @@ bool ARMExecutableWriter<ELFT>::createIm
}
template <class ELFT>
-LLD_UNIQUE_BUMP_PTR(SymbolTable<ELFT>)
+unique_bump_ptr<SymbolTable<ELFT>>
ARMExecutableWriter<ELFT>::createSymbolTable() {
- return LLD_UNIQUE_BUMP_PTR(SymbolTable<ELFT>)(
+ return unique_bump_ptr<SymbolTable<ELFT>>(
new (this->_alloc) ARMSymbolTable<ELFT>(this->_context));
}
Modified: lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h?rev=231756&r1=231755&r2=231756&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h Tue Mar 10 00:14:24 2015
@@ -318,8 +318,8 @@ protected:
std::vector<OutputSection<ELFT> *> _outputSections;
ELFHeader<ELFT> *_elfHeader;
ProgramHeader<ELFT> *_programHeader;
- LLD_UNIQUE_BUMP_PTR(RelocationTable<ELFT>) _dynamicRelocationTable;
- LLD_UNIQUE_BUMP_PTR(RelocationTable<ELFT>) _pltRelocationTable;
+ unique_bump_ptr<RelocationTable<ELFT>> _dynamicRelocationTable;
+ unique_bump_ptr<RelocationTable<ELFT>> _pltRelocationTable;
std::vector<lld::AtomLayout *> _absoluteAtoms;
AtomSetT _referencedDynAtoms;
llvm::StringSet<> _copiedDynSymNames;
Modified: lld/trunk/lib/ReaderWriter/ELF/ExecutableWriter.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ExecutableWriter.h?rev=231756&r1=231755&r2=231756&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/ExecutableWriter.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/ExecutableWriter.h Tue Mar 10 00:14:24 2015
@@ -40,7 +40,7 @@ protected:
return this->_layout.isCopied(sla);
}
- LLD_UNIQUE_BUMP_PTR(InterpSection<ELFT>) _interpSection;
+ unique_bump_ptr<InterpSection<ELFT>> _interpSection;
std::unique_ptr<CRuntimeFile<ELFT> > _runtimeFile;
};
Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsDynamicLibraryWriter.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsDynamicLibraryWriter.h?rev=231756&r1=231755&r2=231756&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsDynamicLibraryWriter.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsDynamicLibraryWriter.h Tue Mar 10 00:14:24 2015
@@ -39,10 +39,10 @@ protected:
return std::error_code();
}
- LLD_UNIQUE_BUMP_PTR(SymbolTable<ELFT>) createSymbolTable() override;
- LLD_UNIQUE_BUMP_PTR(DynamicTable<ELFT>) createDynamicTable() override;
+ unique_bump_ptr<SymbolTable<ELFT>> createSymbolTable() override;
+ unique_bump_ptr<DynamicTable<ELFT>> createDynamicTable() override;
- LLD_UNIQUE_BUMP_PTR(DynamicSymbolTable<ELFT>)
+ unique_bump_ptr<DynamicSymbolTable<ELFT>>
createDynamicSymbolTable() override;
private:
@@ -72,27 +72,27 @@ void MipsDynamicLibraryWriter<ELFT>::fin
}
template <class ELFT>
-LLD_UNIQUE_BUMP_PTR(SymbolTable<ELFT>)
+unique_bump_ptr<SymbolTable<ELFT>>
MipsDynamicLibraryWriter<ELFT>::createSymbolTable() {
- return LLD_UNIQUE_BUMP_PTR(SymbolTable<ELFT>)(new (
+ return unique_bump_ptr<SymbolTable<ELFT>>(new (
this->_alloc) MipsSymbolTable<ELFT>(this->_context));
}
/// \brief create dynamic table
template <class ELFT>
-LLD_UNIQUE_BUMP_PTR(DynamicTable<ELFT>)
+unique_bump_ptr<DynamicTable<ELFT>>
MipsDynamicLibraryWriter<ELFT>::createDynamicTable() {
- return LLD_UNIQUE_BUMP_PTR(DynamicTable<ELFT>)(new (
+ return unique_bump_ptr<DynamicTable<ELFT>>(new (
this->_alloc) MipsDynamicTable<ELFT>(this->_context, _mipsTargetLayout));
}
/// \brief create dynamic symbol table
template <class ELFT>
-LLD_UNIQUE_BUMP_PTR(DynamicSymbolTable<ELFT>)
+unique_bump_ptr<DynamicSymbolTable<ELFT>>
MipsDynamicLibraryWriter<ELFT>::createDynamicSymbolTable() {
- return LLD_UNIQUE_BUMP_PTR(
- DynamicSymbolTable<ELFT>)(new (this->_alloc) MipsDynamicSymbolTable<ELFT>(
- this->_context, _mipsTargetLayout));
+ return unique_bump_ptr<DynamicSymbolTable<ELFT>>(
+ new (this->_alloc) MipsDynamicSymbolTable<ELFT>(
+ this->_context, _mipsTargetLayout));
}
} // namespace elf
Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsExecutableWriter.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsExecutableWriter.h?rev=231756&r1=231755&r2=231756&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsExecutableWriter.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsExecutableWriter.h Tue Mar 10 00:14:24 2015
@@ -33,10 +33,10 @@ protected:
void finalizeDefaultAtomValues() override;
std::error_code setELFHeader() override;
- LLD_UNIQUE_BUMP_PTR(SymbolTable<ELFT>) createSymbolTable() override;
- LLD_UNIQUE_BUMP_PTR(DynamicTable<ELFT>) createDynamicTable() override;
+ unique_bump_ptr<SymbolTable<ELFT>> createSymbolTable() override;
+ unique_bump_ptr<DynamicTable<ELFT>> createDynamicTable() override;
- LLD_UNIQUE_BUMP_PTR(DynamicSymbolTable<ELFT>)
+ unique_bump_ptr<DynamicSymbolTable<ELFT>>
createDynamicSymbolTable() override;
private:
@@ -125,27 +125,27 @@ void MipsExecutableWriter<ELFT>::finaliz
}
template <class ELFT>
-LLD_UNIQUE_BUMP_PTR(SymbolTable<ELFT>)
+unique_bump_ptr<SymbolTable<ELFT>>
MipsExecutableWriter<ELFT>::createSymbolTable() {
- return LLD_UNIQUE_BUMP_PTR(SymbolTable<ELFT>)(new (
+ return unique_bump_ptr<SymbolTable<ELFT>>(new (
this->_alloc) MipsSymbolTable<ELFT>(this->_context));
}
/// \brief create dynamic table
template <class ELFT>
-LLD_UNIQUE_BUMP_PTR(DynamicTable<ELFT>)
+unique_bump_ptr<DynamicTable<ELFT>>
MipsExecutableWriter<ELFT>::createDynamicTable() {
- return LLD_UNIQUE_BUMP_PTR(DynamicTable<ELFT>)(new (
+ return unique_bump_ptr<DynamicTable<ELFT>>(new (
this->_alloc) MipsDynamicTable<ELFT>(this->_context, _mipsTargetLayout));
}
/// \brief create dynamic symbol table
template <class ELFT>
-LLD_UNIQUE_BUMP_PTR(DynamicSymbolTable<ELFT>)
+unique_bump_ptr<DynamicSymbolTable<ELFT>>
MipsExecutableWriter<ELFT>::createDynamicSymbolTable() {
- return LLD_UNIQUE_BUMP_PTR(
- DynamicSymbolTable<ELFT>)(new (this->_alloc) MipsDynamicSymbolTable<ELFT>(
- this->_context, _mipsTargetLayout));
+ return unique_bump_ptr<DynamicSymbolTable<ELFT>>(
+ new (this->_alloc) MipsDynamicSymbolTable<ELFT>(
+ this->_context, _mipsTargetLayout));
}
} // namespace elf
Modified: lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h?rev=231756&r1=231755&r2=231756&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h Tue Mar 10 00:14:24 2015
@@ -102,13 +102,13 @@ protected:
virtual void createDefaultDynamicEntries() {}
/// \brief Create symbol table.
- virtual LLD_UNIQUE_BUMP_PTR(SymbolTable<ELFT>) createSymbolTable();
+ virtual unique_bump_ptr<SymbolTable<ELFT>> createSymbolTable();
/// \brief create dynamic table.
- virtual LLD_UNIQUE_BUMP_PTR(DynamicTable<ELFT>) createDynamicTable();
+ virtual unique_bump_ptr<DynamicTable<ELFT>> createDynamicTable();
/// \brief create dynamic symbol table.
- virtual LLD_UNIQUE_BUMP_PTR(DynamicSymbolTable<ELFT>)
+ virtual unique_bump_ptr<DynamicSymbolTable<ELFT>>
createDynamicSymbolTable();
/// \brief Create entry in the dynamic symbols table for this atom.
@@ -129,19 +129,19 @@ protected:
typedef llvm::DenseMap<const Atom *, uint64_t> AtomToAddress;
AtomToAddress _atomToAddressMap;
TargetLayout<ELFT> &_layout;
- LLD_UNIQUE_BUMP_PTR(ELFHeader<ELFT>) _elfHeader;
- LLD_UNIQUE_BUMP_PTR(ProgramHeader<ELFT>) _programHeader;
- LLD_UNIQUE_BUMP_PTR(SymbolTable<ELFT>) _symtab;
- LLD_UNIQUE_BUMP_PTR(StringTable<ELFT>) _strtab;
- LLD_UNIQUE_BUMP_PTR(StringTable<ELFT>) _shstrtab;
- LLD_UNIQUE_BUMP_PTR(SectionHeader<ELFT>) _shdrtab;
- LLD_UNIQUE_BUMP_PTR(EHFrameHeader<ELFT>) _ehFrameHeader;
+ unique_bump_ptr<ELFHeader<ELFT>> _elfHeader;
+ unique_bump_ptr<ProgramHeader<ELFT>> _programHeader;
+ unique_bump_ptr<SymbolTable<ELFT>> _symtab;
+ unique_bump_ptr<StringTable<ELFT>> _strtab;
+ unique_bump_ptr<StringTable<ELFT>> _shstrtab;
+ unique_bump_ptr<SectionHeader<ELFT>> _shdrtab;
+ unique_bump_ptr<EHFrameHeader<ELFT>> _ehFrameHeader;
/// \name Dynamic sections.
/// @{
- LLD_UNIQUE_BUMP_PTR(DynamicTable<ELFT>) _dynamicTable;
- LLD_UNIQUE_BUMP_PTR(DynamicSymbolTable<ELFT>) _dynamicSymbolTable;
- LLD_UNIQUE_BUMP_PTR(StringTable<ELFT>) _dynamicStringTable;
- LLD_UNIQUE_BUMP_PTR(HashSection<ELFT>) _hashTable;
+ unique_bump_ptr<DynamicTable<ELFT>> _dynamicTable;
+ unique_bump_ptr<DynamicSymbolTable<ELFT>> _dynamicSymbolTable;
+ unique_bump_ptr<StringTable<ELFT>> _dynamicStringTable;
+ unique_bump_ptr<HashSection<ELFT>> _hashTable;
llvm::StringSet<> _soNeeded;
/// @}
@@ -368,27 +368,27 @@ template <class ELFT> void OutputELFWrit
}
template <class ELFT>
-LLD_UNIQUE_BUMP_PTR(SymbolTable<ELFT>)
+unique_bump_ptr<SymbolTable<ELFT>>
OutputELFWriter<ELFT>::createSymbolTable() {
- return LLD_UNIQUE_BUMP_PTR(SymbolTable<ELFT>)(new (_alloc) SymbolTable<ELFT>(
+ return unique_bump_ptr<SymbolTable<ELFT>>(new (_alloc) SymbolTable<ELFT>(
this->_context, ".symtab", DefaultLayout<ELFT>::ORDER_SYMBOL_TABLE));
}
/// \brief create dynamic table
template <class ELFT>
-LLD_UNIQUE_BUMP_PTR(DynamicTable<ELFT>)
+unique_bump_ptr<DynamicTable<ELFT>>
OutputELFWriter<ELFT>::createDynamicTable() {
- return LLD_UNIQUE_BUMP_PTR(
- DynamicTable<ELFT>)(new (_alloc) DynamicTable<ELFT>(
+ return unique_bump_ptr<DynamicTable<ELFT>>(
+ new (_alloc) DynamicTable<ELFT>(
this->_context, _layout, ".dynamic", DefaultLayout<ELFT>::ORDER_DYNAMIC));
}
/// \brief create dynamic symbol table
template <class ELFT>
-LLD_UNIQUE_BUMP_PTR(DynamicSymbolTable<ELFT>)
+unique_bump_ptr<DynamicSymbolTable<ELFT>>
OutputELFWriter<ELFT>::createDynamicSymbolTable() {
- return LLD_UNIQUE_BUMP_PTR(
- DynamicSymbolTable<ELFT>)(new (_alloc) DynamicSymbolTable<ELFT>(
+ return unique_bump_ptr<DynamicSymbolTable<ELFT>>(
+ new (_alloc) DynamicSymbolTable<ELFT>(
this->_context, _layout, ".dynsym",
DefaultLayout<ELFT>::ORDER_DYNAMIC_SYMBOLS));
}
More information about the llvm-commits
mailing list