forked from OSchip/llvm-project
Use template aliases.
We dropped Visual Studio 2012 support, so we can use template aliases. llvm-svn: 231756
This commit is contained in:
parent
51b75b8c34
commit
81ad639ed3
|
@ -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
|
||||
|
||||
|
|
|
@ -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>::createImplicitFiles(
|
|||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
@ -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>::finalizeDefaultAtomValues() {
|
|||
}
|
||||
|
||||
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
|
||||
|
|
|
@ -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>::finalizeDefaultAtomValues() {
|
|||
}
|
||||
|
||||
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
|
||||
|
|
|
@ -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 OutputELFWriter<ELFT>::createDefaultSections() {
|
|||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue