[lld] r286370 - Add a convenience getObj method. NFC.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 9 06:39:20 PST 2016


Author: rafael
Date: Wed Nov  9 08:39:20 2016
New Revision: 286370

URL: http://llvm.org/viewvc/llvm-project?rev=286370&view=rev
Log:
Add a convenience getObj method. NFC.

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

Modified: lld/trunk/ELF/ICF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/ICF.cpp?rev=286370&r1=286369&r2=286370&view=diff
==============================================================================
--- lld/trunk/ELF/ICF.cpp (original)
+++ lld/trunk/ELF/ICF.cpp Wed Nov  9 08:39:20 2016
@@ -218,8 +218,8 @@ bool ICF<ELFT>::equalsConstant(const Inp
   for (size_t I = 0, E = A->RelocSections.size(); I != E; ++I) {
     const Elf_Shdr *RA = A->RelocSections[I];
     const Elf_Shdr *RB = B->RelocSections[I];
-    ELFFile<ELFT> FileA = A->File->getObj();
-    ELFFile<ELFT> FileB = B->File->getObj();
+    ELFFile<ELFT> FileA = A->getObj();
+    ELFFile<ELFT> FileB = B->getObj();
     if (RA->sh_type == SHT_RELA) {
       if (!relocationEq(check(FileA.relas(RA)), check(FileB.relas(RB))))
         return false;
@@ -271,8 +271,8 @@ bool ICF<ELFT>::equalsVariable(const Inp
   for (size_t I = 0, E = A->RelocSections.size(); I != E; ++I) {
     const Elf_Shdr *RA = A->RelocSections[I];
     const Elf_Shdr *RB = B->RelocSections[I];
-    ELFFile<ELFT> FileA = A->File->getObj();
-    ELFFile<ELFT> FileB = B->File->getObj();
+    ELFFile<ELFT> FileA = A->getObj();
+    ELFFile<ELFT> FileB = B->getObj();
     if (RA->sh_type == SHT_RELA) {
       if (!variableEq(A, B, check(FileA.relas(RA)), check(FileB.relas(RB))))
         return false;

Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=286370&r1=286369&r2=286370&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Wed Nov  9 08:39:20 2016
@@ -470,9 +470,9 @@ void InputSectionBase<ELFT>::relocate(ui
   if (IS && !(IS->Flags & SHF_ALLOC)) {
     for (const Elf_Shdr *RelSec : IS->RelocSections) {
       if (RelSec->sh_type == SHT_RELA)
-        IS->relocateNonAlloc(Buf, check(IS->File->getObj().relas(RelSec)));
+        IS->relocateNonAlloc(Buf, check(IS->getObj().relas(RelSec)));
       else
-        IS->relocateNonAlloc(Buf, check(IS->File->getObj().rels(RelSec)));
+        IS->relocateNonAlloc(Buf, check(IS->getObj().rels(RelSec)));
     }
     return;
   }
@@ -607,7 +607,7 @@ template <class ELFT> void EhInputSectio
     return;
 
   if (RelocSection) {
-    ELFFile<ELFT> Obj = this->File->getObj();
+    ELFFile<ELFT> Obj = this->getObj();
     if (RelocSection->sh_type == SHT_RELA)
       split(check(Obj.relas(RelocSection)));
     else

Modified: lld/trunk/ELF/InputSection.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.h?rev=286370&r1=286369&r2=286370&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.h (original)
+++ lld/trunk/ELF/InputSection.h Wed Nov  9 08:39:20 2016
@@ -119,6 +119,7 @@ public:
   static InputSectionBase<ELFT> Discarded;
 
   ObjectFile<ELFT> *getFile() const { return File; }
+  llvm::object::ELFFile<ELFT> getObj() const { return File->getObj(); }
   uintX_t getOffset(const DefinedRegular<ELFT> &Sym) const;
   InputSectionBase *getLinkOrderDep() const;
   // Translate an offset in the input section to an offset in the output




More information about the llvm-commits mailing list