[lld] r345093 - Move a function out of a class because it doesn't depend on any class member. NFC.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 23 15:31:08 PDT 2018


Author: ruiu
Date: Tue Oct 23 15:31:08 2018
New Revision: 345093

URL: http://llvm.org/viewvc/llvm-project?rev=345093&view=rev
Log:
Move a function out of a class because it doesn't depend on any class member. NFC.

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

Modified: lld/trunk/ELF/Relocations.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=345093&r1=345092&r2=345093&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Tue Oct 23 15:31:08 2018
@@ -1088,6 +1088,20 @@ static bool mergeCmp(const InputSection
   return false;
 }
 
+// Call Fn on every executable InputSection accessed via the linker script
+// InputSectionDescription::Sections.
+static void forEachInputSectionDescription(
+    ArrayRef<OutputSection *> OutputSections,
+    llvm::function_ref<void(OutputSection *, InputSectionDescription *)> Fn) {
+  for (OutputSection *OS : OutputSections) {
+    if (!(OS->Flags & SHF_ALLOC) || !(OS->Flags & SHF_EXECINSTR))
+      continue;
+    for (BaseCommand *BC : OS->SectionCommands)
+      if (auto *ISD = dyn_cast<InputSectionDescription>(BC))
+        Fn(OS, ISD);
+  }
+}
+
 // Thunk Implementation
 //
 // Thunks (sometimes called stubs, veneers or branch islands) are small pieces
@@ -1355,20 +1369,6 @@ std::pair<Thunk *, bool> ThunkCreator::g
   return std::make_pair(T, true);
 }
 
-// Call Fn on every executable InputSection accessed via the linker script
-// InputSectionDescription::Sections.
-void ThunkCreator::forEachInputSectionDescription(
-    ArrayRef<OutputSection *> OutputSections,
-    llvm::function_ref<void(OutputSection *, InputSectionDescription *)> Fn) {
-  for (OutputSection *OS : OutputSections) {
-    if (!(OS->Flags & SHF_ALLOC) || !(OS->Flags & SHF_EXECINSTR))
-      continue;
-    for (BaseCommand *BC : OS->SectionCommands)
-      if (auto *ISD = dyn_cast<InputSectionDescription>(BC))
-        Fn(OS, ISD);
-  }
-}
-
 // Return true if the relocation target is an in range Thunk.
 // Return false if the relocation is not to a Thunk. If the relocation target
 // was originally to a Thunk, but is no longer in range we revert the

Modified: lld/trunk/ELF/Relocations.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.h?rev=345093&r1=345092&r2=345093&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.h (original)
+++ lld/trunk/ELF/Relocations.h Tue Oct 23 15:31:08 2018
@@ -173,10 +173,6 @@ private:
 
   void createInitialThunkSections(ArrayRef<OutputSection *> OutputSections);
 
-  void forEachInputSectionDescription(
-      ArrayRef<OutputSection *> OutputSections,
-      llvm::function_ref<void(OutputSection *, InputSectionDescription *)> Fn);
-
   std::pair<Thunk *, bool> getThunk(Symbol &Sym, RelType Type, uint64_t Src);
 
   ThunkSection *addThunkSection(OutputSection *OS, InputSectionDescription *,




More information about the llvm-commits mailing list