[llvm] r339448 - [llvm-objcopy] NFC: consistently use typename ELFT::<X> definitions in headers
Jordan Rupprecht via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 10 09:25:58 PDT 2018
Author: rupprecht
Date: Fri Aug 10 09:25:58 2018
New Revision: 339448
URL: http://llvm.org/viewvc/llvm-project?rev=339448&view=rev
Log:
[llvm-objcopy] NFC: consistently use typename ELFT::<X> definitions in headers
Modified:
llvm/trunk/tools/llvm-objcopy/Object.cpp
llvm/trunk/tools/llvm-objcopy/Object.h
Modified: llvm/trunk/tools/llvm-objcopy/Object.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objcopy/Object.cpp?rev=339448&r1=339447&r2=339448&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objcopy/Object.cpp (original)
+++ llvm/trunk/tools/llvm-objcopy/Object.cpp Fri Aug 10 09:25:58 2018
@@ -63,8 +63,6 @@ std::unique_ptr<WritableMemoryBuffer> Me
}
template <class ELFT> void ELFWriter<ELFT>::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<Elf_Phdr *>(B);
@@ -87,7 +85,7 @@ void SectionBase::markSymbols() {}
template <class ELFT> void ELFWriter<ELFT>::writeShdr(const SectionBase &Sec) {
uint8_t *B = Buf.getBufferStart();
B += Sec.HeaderOffset;
- typename ELFT::Shdr &Shdr = *reinterpret_cast<typename ELFT::Shdr *>(B);
+ Elf_Shdr &Shdr = *reinterpret_cast<Elf_Shdr *>(B);
Shdr.sh_name = Sec.NameIndex;
Shdr.sh_type = Sec.Type;
Shdr.sh_flags = Sec.Flags;
@@ -162,7 +160,7 @@ void StringTableSection::accept(SectionV
template <class ELFT>
void ELFSectionWriter<ELFT>::visit(const SectionIndexSection &Sec) {
uint8_t *Buf = Out.getBufferStart() + Sec.Offset;
- auto *IndexesBuffer = reinterpret_cast<typename ELFT::Word *>(Buf);
+ auto *IndexesBuffer = reinterpret_cast<Elf_Word *>(Buf);
std::copy(std::begin(Sec.Indexes), std::end(Sec.Indexes), IndexesBuffer);
}
@@ -344,7 +342,7 @@ template <class ELFT>
void ELFSectionWriter<ELFT>::visit(const SymbolTableSection &Sec) {
uint8_t *Buf = Out.getBufferStart();
Buf += Sec.Offset;
- typename ELFT::Sym *Sym = reinterpret_cast<typename ELFT::Sym *>(Buf);
+ Elf_Sym *Sym = reinterpret_cast<Elf_Sym *>(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 <class ELFT> void ELFWriter<ELF
// 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;
}
Modified: llvm/trunk/tools/llvm-objcopy/Object.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objcopy/Object.h?rev=339448&r1=339447&r2=339448&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objcopy/Object.h (original)
+++ llvm/trunk/tools/llvm-objcopy/Object.h Fri Aug 10 09:25:58 2018
@@ -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 ELFT> 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;
More information about the llvm-commits
mailing list