From de965ea87b6decd02a6f0a923f24ed2647c8f675 Mon Sep 17 00:00:00 2001 From: Jordan Rupprecht Date: Fri, 10 Aug 2018 16:25:58 +0000 Subject: [PATCH] [llvm-objcopy] NFC: consistently use typename ELFT:: definitions in headers llvm-svn: 339448 --- llvm/tools/llvm-objcopy/Object.cpp | 10 ++++------ llvm/tools/llvm-objcopy/Object.h | 2 ++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/llvm/tools/llvm-objcopy/Object.cpp b/llvm/tools/llvm-objcopy/Object.cpp index 616de86b..1fb0de8 100644 --- a/llvm/tools/llvm-objcopy/Object.cpp +++ b/llvm/tools/llvm-objcopy/Object.cpp @@ -63,8 +63,6 @@ std::unique_ptr MemBuffer::releaseMemoryBuffer() { } template void ELFWriter::writePhdr(const Segment &Seg) { - using Elf_Phdr = typename ELFT::Phdr; - uint8_t *B = Buf.getBufferStart(); B += Obj.ProgramHdrSegment.Offset + Seg.Index * sizeof(Elf_Phdr); Elf_Phdr &Phdr = *reinterpret_cast(B); @@ -87,7 +85,7 @@ void SectionBase::markSymbols() {} template void ELFWriter::writeShdr(const SectionBase &Sec) { uint8_t *B = Buf.getBufferStart(); B += Sec.HeaderOffset; - typename ELFT::Shdr &Shdr = *reinterpret_cast(B); + Elf_Shdr &Shdr = *reinterpret_cast(B); Shdr.sh_name = Sec.NameIndex; Shdr.sh_type = Sec.Type; Shdr.sh_flags = Sec.Flags; @@ -162,7 +160,7 @@ void StringTableSection::accept(SectionVisitor &Visitor) const { template void ELFSectionWriter::visit(const SectionIndexSection &Sec) { uint8_t *Buf = Out.getBufferStart() + Sec.Offset; - auto *IndexesBuffer = reinterpret_cast(Buf); + auto *IndexesBuffer = reinterpret_cast(Buf); std::copy(std::begin(Sec.Indexes), std::end(Sec.Indexes), IndexesBuffer); } @@ -344,7 +342,7 @@ template void ELFSectionWriter::visit(const SymbolTableSection &Sec) { uint8_t *Buf = Out.getBufferStart(); Buf += Sec.Offset; - typename ELFT::Sym *Sym = reinterpret_cast(Buf); + Elf_Sym *Sym = reinterpret_cast(Buf); // Loop though symbols setting each entry of the symbol table. for (auto &Symbol : Sec.Symbols) { Sym->st_name = Symbol->NameIndex; @@ -1193,7 +1191,7 @@ template void ELFWriter::assignOffsets() { // If we need to write the section header table out then we need to align the // Offset so that SHOffset is valid. if (WriteSectionHeaders) - Offset = alignTo(Offset, sizeof(typename ELFT::Addr)); + Offset = alignTo(Offset, sizeof(Elf_Addr)); Obj.SHOffset = Offset; } diff --git a/llvm/tools/llvm-objcopy/Object.h b/llvm/tools/llvm-objcopy/Object.h index 525c5e3..8b74528 100644 --- a/llvm/tools/llvm-objcopy/Object.h +++ b/llvm/tools/llvm-objcopy/Object.h @@ -104,6 +104,7 @@ private: using Elf_Word = typename ELFT::Word; using Elf_Rel = typename ELFT::Rel; using Elf_Rela = typename ELFT::Rela; + using Elf_Sym = typename ELFT::Sym; public: virtual ~ELFSectionWriter() {} @@ -190,6 +191,7 @@ public: template class ELFWriter : public Writer { private: + using Elf_Addr = typename ELFT::Addr; using Elf_Shdr = typename ELFT::Shdr; using Elf_Phdr = typename ELFT::Phdr; using Elf_Ehdr = typename ELFT::Ehdr; -- 2.7.4