[lld] r251140 - Drop a few const to reduce the noise from the next patch. NFC.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 23 12:55:11 PDT 2015


Author: rafael
Date: Fri Oct 23 14:55:11 2015
New Revision: 251140

URL: http://llvm.org/viewvc/llvm-project?rev=251140&view=rev
Log:
Drop a few const to reduce the noise from the next patch. NFC.

Modified:
    lld/trunk/ELF/InputSection.cpp
    lld/trunk/ELF/InputSection.h
    lld/trunk/ELF/OutputSections.cpp

Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=251140&r1=251139&r2=251140&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Fri Oct 23 14:55:11 2015
@@ -43,7 +43,7 @@ ArrayRef<uint8_t> InputSectionBase<ELFT>
 
 template <class ELFT>
 typename ELFFile<ELFT>::uintX_t
-InputSectionBase<ELFT>::getOffset(const Elf_Sym &Sym) const {
+InputSectionBase<ELFT>::getOffset(const Elf_Sym &Sym) {
   if (auto *S = dyn_cast<InputSection<ELFT>>(this))
     return S->OutSecOff + Sym.st_value;
   return cast<MergeInputSection<ELFT>>(this)->getOffset(Sym.st_value);
@@ -132,7 +132,7 @@ bool MergeInputSection<ELFT>::classof(co
 // FIXME: Optimize this by keeping an offset for each element.
 template <class ELFT>
 typename MergeInputSection<ELFT>::uintX_t
-MergeInputSection<ELFT>::getOffset(uintX_t Offset) const {
+MergeInputSection<ELFT>::getOffset(uintX_t Offset) {
   ArrayRef<uint8_t> Data = this->getSectionData();
   uintX_t EntSize = this->Header->sh_entsize;
   uintX_t Addend = Offset % EntSize;

Modified: lld/trunk/ELF/InputSection.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.h?rev=251140&r1=251139&r2=251140&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.h (original)
+++ lld/trunk/ELF/InputSection.h Fri Oct 23 14:55:11 2015
@@ -61,7 +61,7 @@ public:
     return std::max<uintX_t>(Header->sh_addralign, 1);
   }
 
-  uintX_t getOffset(const Elf_Sym &Sym) const;
+  uintX_t getOffset(const Elf_Sym &Sym);
   ArrayRef<uint8_t> getSectionData() const;
 };
 
@@ -80,7 +80,7 @@ template <class ELFT> class MergeInputSe
 public:
   MergeInputSection(ObjectFile<ELFT> *F, const Elf_Shdr *Header);
   static bool classof(const InputSectionBase<ELFT> *S);
-  uintX_t getOffset(uintX_t Offset) const;
+  uintX_t getOffset(uintX_t Offset);
 };
 
 // This corresponds to a non SHF_MERGE section of an input file.

Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=251140&r1=251139&r2=251140&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Fri Oct 23 14:55:11 2015
@@ -610,7 +610,7 @@ typename ELFFile<ELFT>::uintX_t lld::elf
     return cast<DefinedAbsolute<ELFT>>(S).Sym.st_value;
   case SymbolBody::DefinedRegularKind: {
     const auto &DR = cast<DefinedRegular<ELFT>>(S);
-    const InputSectionBase<ELFT> &SC = DR.Section;
+    InputSectionBase<ELFT> &SC = DR.Section;
     return SC.OutSec->getVA() + SC.getOffset(DR.Sym);
   }
   case SymbolBody::DefinedCommonKind:
@@ -903,7 +903,7 @@ void SymbolTableSection<ELFT>::writeLoca
         ESym->st_shndx = SHN_ABS;
         VA = Sym.st_value;
       } else {
-        const InputSectionBase<ELFT> *Section = File->getSection(Sym);
+        InputSectionBase<ELFT> *Section = File->getSection(Sym);
         if (!Section->isLive())
           continue;
         const OutputSectionBase<ELFT> *OutSec = Section->OutSec;




More information about the llvm-commits mailing list