[PATCH] D30084: [ELF] - Move DependentSections vector from InputSection to InputSectionBase

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 17 14:32:26 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL295483: [ELF] - Move DependentSections vector from InputSection to InputSectionBase (authored by grimar).

Changed prior to commit:
  https://reviews.llvm.org/D30084?vs=88867&id=88960#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30084

Files:
  lld/trunk/ELF/InputFiles.cpp
  lld/trunk/ELF/InputSection.h
  lld/trunk/ELF/LinkerScript.cpp


Index: lld/trunk/ELF/InputSection.h
===================================================================
--- lld/trunk/ELF/InputSection.h
+++ lld/trunk/ELF/InputSection.h
@@ -128,6 +128,9 @@
   // this but instead this->Repl.
   InputSectionBase<ELFT> *Repl;
 
+  // InputSections that are dependent on us (reverse dependency for GC)
+  llvm::TinyPtrVector<InputSectionBase<ELFT> *> DependentSections;
+
   // Returns the size of this section (even if this is a common or BSS.)
   size_t getSize() const;
 
@@ -281,9 +284,6 @@
   // to. The writer sets a value.
   uint64_t OutSecOff = 0;
 
-  // InputSections that are dependent on us (reverse dependency for GC)
-  llvm::TinyPtrVector<InputSectionBase<ELFT> *> DependentSections;
-
   static bool classof(const InputSectionData *S);
 
   InputSectionBase<ELFT> *getRelocatedSection();
Index: lld/trunk/ELF/InputFiles.cpp
===================================================================
--- lld/trunk/ELF/InputFiles.cpp
+++ lld/trunk/ELF/InputFiles.cpp
@@ -322,8 +322,7 @@
       if (Sec.sh_link >= Sections.size())
         fatal(toString(this) + ": invalid sh_link index: " +
               Twine(Sec.sh_link));
-      auto *IS = cast<InputSection<ELFT>>(Sections[Sec.sh_link]);
-      IS->DependentSections.push_back(Sections[I]);
+      Sections[Sec.sh_link]->DependentSections.push_back(Sections[I]);
     }
   }
 }
Index: lld/trunk/ELF/LinkerScript.cpp
===================================================================
--- lld/trunk/ELF/LinkerScript.cpp
+++ lld/trunk/ELF/LinkerScript.cpp
@@ -298,11 +298,7 @@
     S->Live = false;
     if (S == In<ELFT>::ShStrTab)
       error("discarding .shstrtab section is not allowed");
-
-    InputSection<ELFT> *IS = dyn_cast<InputSection<ELFT>>(S);
-    if (!IS || IS->DependentSections.empty())
-      continue;
-    discard(IS->DependentSections);
+    discard(S->DependentSections);
   }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30084.88960.patch
Type: text/x-patch
Size: 1900 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170217/af0b09d4/attachment.bin>


More information about the llvm-commits mailing list