[lld] r281381 - Inline small funciton.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 13 12:56:28 PDT 2016


Author: ruiu
Date: Tue Sep 13 14:56:27 2016
New Revision: 281381

URL: http://llvm.org/viewvc/llvm-project?rev=281381&view=rev
Log:
Inline small funciton.

Modified:
    lld/trunk/ELF/MarkLive.cpp

Modified: lld/trunk/ELF/MarkLive.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/MarkLive.cpp?rev=281381&r1=281380&r2=281381&view=diff
==============================================================================
--- lld/trunk/ELF/MarkLive.cpp (original)
+++ lld/trunk/ELF/MarkLive.cpp Tue Sep 13 14:56:27 2016
@@ -77,25 +77,20 @@ static ResolvedReloc<ELFT> resolveReloc(
   return {D->Section->Repl, Offset};
 }
 
-template <class ELFT, class Elf_Shdr>
-static void run(ELFFile<ELFT> &Obj, InputSectionBase<ELFT> &Sec,
-                Elf_Shdr *RelSec, std::function<void(ResolvedReloc<ELFT>)> Fn) {
-  if (RelSec->sh_type == SHT_RELA) {
-    for (const typename ELFT::Rela &RI : Obj.relas(RelSec))
-      Fn(resolveReloc(Sec, RI));
-  } else {
-    for (const typename ELFT::Rel &RI : Obj.rels(RelSec))
-      Fn(resolveReloc(Sec, RI));
-  }
-}
-
 // Calls Fn for each section that Sec refers to via relocations.
 template <class ELFT>
 static void forEachSuccessor(InputSection<ELFT> &Sec,
                              std::function<void(ResolvedReloc<ELFT>)> Fn) {
   ELFFile<ELFT> &Obj = Sec.getFile()->getObj();
-  for (const typename ELFT::Shdr *RelSec : Sec.RelocSections)
-    run(Obj, Sec, RelSec, Fn);
+  for (const typename ELFT::Shdr *RelSec : Sec.RelocSections) {
+    if (RelSec->sh_type == SHT_RELA) {
+      for (const typename ELFT::Rela &Rel : Obj.relas(RelSec))
+        Fn(resolveReloc(Sec, Rel));
+    } else {
+      for (const typename ELFT::Rel &Rel : Obj.rels(RelSec))
+        Fn(resolveReloc(Sec, Rel));
+    }
+  }
 }
 
 // The .eh_frame section is an unfortunate special case.




More information about the llvm-commits mailing list