ELF: Add override.

Some virtual member functions in ELF directory don't have
virtual type specifier. Add override to them.

llvm-svn: 233406
This commit is contained in:
Rui Ueyama 2015-03-27 20:15:46 +00:00
parent 674aaaa367
commit 7b57cef5b0
3 changed files with 23 additions and 28 deletions

View File

@ -80,7 +80,7 @@ public:
uint64_t memSize() const { return _msize; } uint64_t memSize() const { return _msize; }
void setMemSize(uint64_t msize) { _msize = msize; } void setMemSize(uint64_t msize) { _msize = msize; }
// Whats the contentType of the chunk? // Returns the ContentType of the chunk
virtual int getContentType() const = 0; virtual int getContentType() const = 0;
// Writer the chunk // Writer the chunk

View File

@ -43,19 +43,20 @@ public:
void e_shentsize(uint16_t shentsize) { _eh.e_shentsize = shentsize; } void e_shentsize(uint16_t shentsize) { _eh.e_shentsize = shentsize; }
void e_shnum(uint16_t shnum) { _eh.e_shnum = shnum; } void e_shnum(uint16_t shnum) { _eh.e_shnum = shnum; }
void e_shstrndx(uint16_t shstrndx) { _eh.e_shstrndx = shstrndx; } void e_shstrndx(uint16_t shstrndx) { _eh.e_shstrndx = shstrndx; }
uint64_t fileSize() const { return sizeof(Elf_Ehdr); } uint64_t fileSize() const override { return sizeof(Elf_Ehdr); }
static bool classof(const Chunk<ELFT> *c) { static bool classof(const Chunk<ELFT> *c) {
return c->Kind() == Chunk<ELFT>::Kind::ELFHeader; return c->Kind() == Chunk<ELFT>::Kind::ELFHeader;
} }
int getContentType() const { return Chunk<ELFT>::ContentType::Header; } int getContentType() const override {
return Chunk<ELFT>::ContentType::Header;
}
void write(ELFWriter *writer, TargetLayout<ELFT> &layout, void write(ELFWriter *writer, TargetLayout<ELFT> &layout,
llvm::FileOutputBuffer &buffer); llvm::FileOutputBuffer &buffer) override;
void finalize() override {
void finalize() {
_eh.e_ident[llvm::ELF::EI_CLASS] = _eh.e_ident[llvm::ELF::EI_CLASS] =
(ELFT::Is64Bits) ? llvm::ELF::ELFCLASS64 : llvm::ELF::ELFCLASS32; (ELFT::Is64Bits) ? llvm::ELF::ELFCLASS64 : llvm::ELF::ELFCLASS32;
_eh.e_ident[llvm::ELF::EI_DATA] = _eh.e_ident[llvm::ELF::EI_DATA] =
@ -133,14 +134,14 @@ public:
void resetProgramHeaders() { _phi = _ph.begin(); } void resetProgramHeaders() { _phi = _ph.begin(); }
uint64_t fileSize() const { return sizeof(Elf_Phdr) * _ph.size(); } uint64_t fileSize() const override { return sizeof(Elf_Phdr) * _ph.size(); }
static bool classof(const Chunk<ELFT> *c) { static bool classof(const Chunk<ELFT> *c) {
return c->Kind() == Chunk<ELFT>::Kind::ProgramHeader; return c->Kind() == Chunk<ELFT>::Kind::ProgramHeader;
} }
void write(ELFWriter *writer, TargetLayout<ELFT> &layout, void write(ELFWriter *writer, TargetLayout<ELFT> &layout,
llvm::FileOutputBuffer &buffer); llvm::FileOutputBuffer &buffer) override;
/// \brief find a program header entry in the list of program headers /// \brief find a program header entry in the list of program headers
ReversePhIterT ReversePhIterT
@ -149,27 +150,18 @@ public:
FindPhdr(type, flags, flagClear)); FindPhdr(type, flags, flagClear));
} }
PhIterT begin() { PhIterT begin() { return _ph.begin(); }
return _ph.begin(); PhIterT end() { return _ph.end(); }
}
PhIterT end() {
return _ph.end();
}
ReversePhIterT rbegin() { return _ph.rbegin(); } ReversePhIterT rbegin() { return _ph.rbegin(); }
ReversePhIterT rend() { return _ph.rend(); } ReversePhIterT rend() { return _ph.rend(); }
int64_t entsize() { return sizeof(Elf_Phdr); } int64_t entsize() { return sizeof(Elf_Phdr); }
int64_t numHeaders() { int64_t numHeaders() { return _ph.size(); }
return _ph.size();
}
int getContentType() const { return Chunk<ELFT>::ContentType::Header; } int getContentType() const override {
return Chunk<ELFT>::ContentType::Header;
}
private: private:
Elf_Phdr *allocateProgramHeader(bool &allocatedNew) { Elf_Phdr *allocateProgramHeader(bool &allocatedNew) {
@ -276,15 +268,17 @@ public:
} }
void write(ELFWriter *writer, TargetLayout<ELFT> &layout, void write(ELFWriter *writer, TargetLayout<ELFT> &layout,
llvm::FileOutputBuffer &buffer); llvm::FileOutputBuffer &buffer) override;
uint64_t fileSize() const override {
return sizeof(Elf_Shdr) * _sectionInfo.size();
uint64_t fileSize() const { return sizeof(Elf_Shdr) * _sectionInfo.size(); } }
uint64_t entsize() { return sizeof(Elf_Shdr); } uint64_t entsize() { return sizeof(Elf_Shdr); }
int getContentType() const { return Chunk<ELFT>::ContentType::Header; } int getContentType() const override {
return Chunk<ELFT>::ContentType::Header;
}
uint64_t numHeaders() { return _sectionInfo.size(); } uint64_t numHeaders() { return _sectionInfo.size(); }

View File

@ -285,6 +285,7 @@ public:
int getContentType() const override { int getContentType() const override {
return Chunk<ELFT>::ContentType::Unknown; return Chunk<ELFT>::ContentType::Unknown;
} }
void write(ELFWriter *, TargetLayout<ELFT> &, void write(ELFWriter *, TargetLayout<ELFT> &,
llvm::FileOutputBuffer &) override {} llvm::FileOutputBuffer &) override {}