Commit 5d83ccd5 authored by Rafael Espindola's avatar Rafael Espindola
Browse files

Make getSectionName non virtual. NFC.

llvm-svn: 244939
parent ea133eaa
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -20,11 +20,6 @@ template <class ELFT>
SectionChunk<ELFT>::SectionChunk(object::ELFFile<ELFT> *Obj,
                                 const Elf_Shdr *Header)
    : Obj(Obj), Header(Header) {
  // Initialize SectionName.
  ErrorOr<StringRef> Name = Obj->getSectionName(Header);
  error(Name);
  SectionName = *Name;

  Align = Header->sh_addralign;
}

@@ -38,6 +33,12 @@ template <class ELFT> void SectionChunk<ELFT>::writeTo(uint8_t *Buf) {
  // FIXME: Relocations
}

template <class ELFT> StringRef SectionChunk<ELFT>::getSectionName() const {
  ErrorOr<StringRef> Name = Obj->getSectionName(Header);
  error(Name);
  return *Name;
}

namespace lld {
namespace elf2 {
template class SectionChunk<object::ELF32LE>;
+1 −6
Original line number Diff line number Diff line
@@ -41,10 +41,6 @@ public:
  uint32_t getAlign() { return Align; }
  void setOutputSectionOff(uint64_t V) { OutputSectionOff = V; }

  // Returns the section name if this is a section chunk.
  // It is illegal to call this function on non-section chunks.
  virtual StringRef getSectionName() const = 0;

protected:
  // The offset from beginning of the output sections this chunk was assigned
  // to. The writer sets a value.
@@ -64,7 +60,7 @@ public:
  SectionChunk(llvm::object::ELFFile<ELFT> *Obj, const Elf_Shdr *Header);
  size_t getSize() const override { return Header->sh_size; }
  void writeTo(uint8_t *Buf) override;
  StringRef getSectionName() const override { return SectionName; }
  StringRef getSectionName() const;
  const Elf_Shdr *getSectionHdr() const { return Header; }

private:
@@ -72,7 +68,6 @@ private:
  llvm::object::ELFFile<ELFT> *Obj;

  const Elf_Shdr *Header;
  StringRef SectionName;
};

} // namespace elf2