[lld] r276702 - Do not pass InputFile to reportDiscarded().

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 25 15:26:28 PDT 2016


Author: ruiu
Date: Mon Jul 25 17:26:28 2016
New Revision: 276702

URL: http://llvm.org/viewvc/llvm-project?rev=276702&view=rev
Log:
Do not pass InputFile to reportDiscarded().

Because the file from which an input section is created can be
obtained using getFile().

Modified:
    lld/trunk/ELF/LinkerScript.cpp
    lld/trunk/ELF/Writer.cpp
    lld/trunk/ELF/Writer.h

Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=276702&r1=276701&r2=276702&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Mon Jul 25 17:26:28 2016
@@ -127,7 +127,7 @@ LinkerScript<ELFT>::createSections(Outpu
         if (!S->OutSec)
           AddInputSec(S, getOutputSectionName(S));
       } else
-        reportDiscarded(S, F);
+        reportDiscarded(S);
     }
 
   // Remove from the output all the sections which did not meet

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=276702&r1=276701&r2=276702&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Mon Jul 25 17:26:28 2016
@@ -99,13 +99,11 @@ StringRef elf::getOutputSectionName(Inpu
   return Name;
 }
 
-template <class ELFT>
-void elf::reportDiscarded(InputSectionBase<ELFT> *IS,
-                          const std::unique_ptr<elf::ObjectFile<ELFT>> &File) {
+template <class ELFT> void elf::reportDiscarded(InputSectionBase<ELFT> *IS) {
   if (!Config->PrintGcSections || !IS || IS->Live)
     return;
   errs() << "removing unused section from '" << IS->getSectionName()
-         << "' in file '" << File->getName() << "'\n";
+         << "' in file '" << IS->getFile()->getName() << "'\n";
 }
 
 template <class ELFT> static bool needsInterpSection() {
@@ -668,7 +666,7 @@ std::vector<OutputSectionBase<ELFT> *> W
        Symtab.getObjectFiles()) {
     for (InputSectionBase<ELFT> *C : F->getSections()) {
       if (isDiscarded(C)) {
-        reportDiscarded(C, F);
+        reportDiscarded(C);
         continue;
       }
       OutputSectionBase<ELFT> *Sec;
@@ -1350,15 +1348,7 @@ template StringRef elf::getOutputSection
 template StringRef elf::getOutputSectionName<ELF64LE>(InputSectionBase<ELF64LE> *);
 template StringRef elf::getOutputSectionName<ELF64BE>(InputSectionBase<ELF64BE> *);
 
-template void elf::reportDiscarded<ELF32LE>(
-    InputSectionBase<ELF32LE> *,
-    const std::unique_ptr<elf::ObjectFile<ELF32LE>> &);
-template void elf::reportDiscarded<ELF32BE>(
-    InputSectionBase<ELF32BE> *,
-    const std::unique_ptr<elf::ObjectFile<ELF32BE>> &);
-template void elf::reportDiscarded<ELF64LE>(
-    InputSectionBase<ELF64LE> *,
-    const std::unique_ptr<elf::ObjectFile<ELF64LE>> &);
-template void elf::reportDiscarded<ELF64BE>(
-    InputSectionBase<ELF64BE> *,
-    const std::unique_ptr<elf::ObjectFile<ELF64BE>> &);
+template void elf::reportDiscarded<ELF32LE>(InputSectionBase<ELF32LE> *);
+template void elf::reportDiscarded<ELF32BE>(InputSectionBase<ELF32BE> *);
+template void elf::reportDiscarded<ELF64LE>(InputSectionBase<ELF64LE> *);
+template void elf::reportDiscarded<ELF64BE>(InputSectionBase<ELF64BE> *);

Modified: lld/trunk/ELF/Writer.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.h?rev=276702&r1=276701&r2=276702&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.h (original)
+++ lld/trunk/ELF/Writer.h Mon Jul 25 17:26:28 2016
@@ -46,9 +46,7 @@ struct PhdrEntry {
 template <class ELFT>
 llvm::StringRef getOutputSectionName(InputSectionBase<ELFT> *S);
 
-template <class ELFT>
-void reportDiscarded(InputSectionBase<ELFT> *IS,
-                     const std::unique_ptr<elf::ObjectFile<ELFT>> &File);
+template <class ELFT> void reportDiscarded(InputSectionBase<ELFT> *IS);
 }
 }
 




More information about the llvm-commits mailing list