[lld] r320198 - Make findSection a static function. NFC.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 8 13:44:12 PST 2017


Author: rafael
Date: Fri Dec  8 13:44:11 2017
New Revision: 320198

URL: http://llvm.org/viewvc/llvm-project?rev=320198&view=rev
Log:
Make findSection a static function. NFC.

Modified:
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=320198&r1=320197&r2=320198&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Fri Dec  8 13:44:11 2017
@@ -76,7 +76,6 @@ private:
   void addStartEndSymbols();
   void addStartStopSymbols(OutputSection *Sec);
   uint64_t getEntryAddr();
-  OutputSection *findSection(StringRef Name);
 
   std::vector<PhdrEntry *> Phdrs;
 
@@ -327,6 +326,14 @@ template <class ELFT> void Writer<ELFT>:
     error("failed to write to the output file: " + toString(std::move(E)));
 }
 
+static OutputSection *findSection(StringRef Name) {
+  for (BaseCommand *Base : Script->SectionCommands)
+    if (auto *Sec = dyn_cast<OutputSection>(Base))
+      if (Sec->Name == Name)
+        return Sec;
+  return nullptr;
+}
+
 // Initialize Out members.
 template <class ELFT> void Writer<ELFT>::createSyntheticSections() {
   // Initialize all pointers with NULL. This is needed because
@@ -1434,14 +1441,6 @@ void Writer<ELFT>::addStartStopSymbols(O
   addOptionalRegular<ELFT>(Saver.save("__stop_" + S), Sec, -1, STV_DEFAULT);
 }
 
-template <class ELFT> OutputSection *Writer<ELFT>::findSection(StringRef Name) {
-  for (BaseCommand *Base : Script->SectionCommands)
-    if (auto *Sec = dyn_cast<OutputSection>(Base))
-      if (Sec->Name == Name)
-        return Sec;
-  return nullptr;
-}
-
 static bool needsPtLoad(OutputSection *Sec) {
   if (!(Sec->Flags & SHF_ALLOC))
     return false;




More information about the llvm-commits mailing list