[lld] r244939 - Make getSectionName non virtual. NFC.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 13 12:18:31 PDT 2015


Author: rafael
Date: Thu Aug 13 14:18:30 2015
New Revision: 244939

URL: http://llvm.org/viewvc/llvm-project?rev=244939&view=rev
Log:
Make getSectionName non virtual. NFC.

Modified:
    lld/trunk/ELF/Chunks.cpp
    lld/trunk/ELF/Chunks.h

Modified: lld/trunk/ELF/Chunks.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Chunks.cpp?rev=244939&r1=244938&r2=244939&view=diff
==============================================================================
--- lld/trunk/ELF/Chunks.cpp (original)
+++ lld/trunk/ELF/Chunks.cpp Thu Aug 13 14:18:30 2015
@@ -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<
   // 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>;

Modified: lld/trunk/ELF/Chunks.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Chunks.h?rev=244939&r1=244938&r2=244939&view=diff
==============================================================================
--- lld/trunk/ELF/Chunks.h (original)
+++ lld/trunk/ELF/Chunks.h Thu Aug 13 14:18:30 2015
@@ -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




More information about the llvm-commits mailing list