Skip to content

Commit

Permalink
Simplify some typedefs. NFC.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285863 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
espindola committed Nov 2, 2016
1 parent 3937406 commit a9558ab
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
8 changes: 4 additions & 4 deletions include/llvm/Object/ELF.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ uint32_t ELFFile<ELFT>::getExtendedSymbolTableIndex(
}

template <class ELFT>
ErrorOr<const typename ELFFile<ELFT>::Elf_Shdr *>
ErrorOr<const typename ELFT::Shdr *>
ELFFile<ELFT>::getSection(const Elf_Sym *Sym, const Elf_Shdr *SymTab,
ArrayRef<Elf_Word> ShndxTable) const {
uint32_t Index = Sym->st_shndx;
Expand Down Expand Up @@ -273,7 +273,7 @@ void ELFFile<ELFT>::getRelocationTypeName(uint32_t Type,
}

template <class ELFT>
const typename ELFFile<ELFT>::Elf_Sym *
const typename ELFT::Sym *
ELFFile<ELFT>::getRelocationSymbol(const Elf_Rel *Rel,
const Elf_Shdr *SymTab) const {
uint32_t Index = Rel->getSymbol(isMips64EL());
Expand Down Expand Up @@ -382,7 +382,7 @@ const T *ELFFile<ELFT>::getEntry(const Elf_Shdr *Section,
}

template <class ELFT>
ErrorOr<const typename ELFFile<ELFT>::Elf_Shdr *>
ErrorOr<const typename ELFT::Shdr *>
ELFFile<ELFT>::getSection(uint32_t Index) const {
auto TableOrErr = sections();
if (std::error_code EC = TableOrErr.getError())
Expand Down Expand Up @@ -410,7 +410,7 @@ ELFFile<ELFT>::getStringTable(const Elf_Shdr *Section) const {
}

template <class ELFT>
ErrorOr<ArrayRef<typename ELFFile<ELFT>::Elf_Word>>
ErrorOr<ArrayRef<typename ELFT::Word>>
ELFFile<ELFT>::getSHNDXTable(const Elf_Shdr &Section) const {
assert(Section.sh_type == ELF::SHT_SYMTAB_SHNDX);
auto VOrErr = getSectionContentsAsArray<Elf_Word>(&Section);
Expand Down
23 changes: 11 additions & 12 deletions include/llvm/Object/ELFTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,20 +124,19 @@ struct ELFDataTypeTypedefHelper<ELFType<TargetEndianness, true>>
};

// I really don't like doing this, but the alternative is copypasta.
#define LLVM_ELF_IMPORT_TYPES(E, W) \
typedef typename ELFDataTypeTypedefHelper<ELFType<E, W>>::Elf_Addr Elf_Addr; \
typedef typename ELFDataTypeTypedefHelper<ELFType<E, W>>::Elf_Off Elf_Off; \
typedef typename ELFDataTypeTypedefHelper<ELFType<E, W>>::Elf_Half Elf_Half; \
typedef typename ELFDataTypeTypedefHelper<ELFType<E, W>>::Elf_Word Elf_Word; \
typedef \
typename ELFDataTypeTypedefHelper<ELFType<E, W>>::Elf_Sword Elf_Sword; \
typedef \
typename ELFDataTypeTypedefHelper<ELFType<E, W>>::Elf_Xword Elf_Xword; \
typedef \
typename ELFDataTypeTypedefHelper<ELFType<E, W>>::Elf_Sxword Elf_Sxword;

#define LLVM_ELF_IMPORT_TYPES_ELFT(ELFT) \
LLVM_ELF_IMPORT_TYPES(ELFT::TargetEndianness, ELFT::Is64Bits)
typedef typename ELFT::Addr Elf_Addr; \
typedef typename ELFT::Off Elf_Off; \
typedef typename ELFT::Half Elf_Half; \
typedef typename ELFT::Word Elf_Word; \
typedef typename ELFT::Sword Elf_Sword; \
typedef typename ELFT::Xword Elf_Xword; \
typedef typename ELFT::Sxword Elf_Sxword;

#define LLD_ELF_COMMA ,
#define LLVM_ELF_IMPORT_TYPES(E, W) \
LLVM_ELF_IMPORT_TYPES_ELFT(ELFType<E LLD_ELF_COMMA W>)

// Section header.
template <class ELFT> struct Elf_Shdr_Base;
Expand Down

0 comments on commit a9558ab

Please sign in to comment.