[lld] r357738 - Remove redundant parameters. NFC.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 4 18:30:10 PDT 2019


Author: ruiu
Date: Thu Apr  4 18:30:09 2019
New Revision: 357738

URL: http://llvm.org/viewvc/llvm-project?rev=357738&view=rev
Log:
Remove redundant parameters. 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=357738&r1=357737&r2=357738&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Thu Apr  4 18:30:09 2019
@@ -560,9 +560,8 @@ template <class ELFT> void Writer<ELFT>:
     error("failed to write to the output file: " + toString(std::move(E)));
 }
 
-static bool shouldKeepInSymtab(SectionBase *Sec, StringRef SymName,
-                               const Symbol &B) {
-  if (B.isSection())
+static bool shouldKeepInSymtab(const Defined &Sym) {
+  if (Sym.isSection())
     return false;
 
   if (Config->Discard == DiscardPolicy::None)
@@ -573,12 +572,15 @@ static bool shouldKeepInSymtab(SectionBa
   // * --discard-locals is used.
   // * The symbol is in a SHF_MERGE section, which is normally the reason for
   //   the assembler keeping the .L symbol.
-  if (!SymName.startswith(".L") && !SymName.empty())
+  StringRef Name = Sym.getName();
+  bool IsLocal = Name.startswith(".L") || Name.empty();
+  if (!IsLocal)
     return true;
 
   if (Config->Discard == DiscardPolicy::Locals)
     return false;
 
+  SectionBase *Sec = Sym.Section;
   return !Sec || !(Sec->Flags & SHF_MERGE);
 }
 
@@ -623,9 +625,7 @@ template <class ELFT> void Writer<ELFT>:
         continue;
       if (!includeInSymtab(*B))
         continue;
-
-      SectionBase *Sec = DR->Section;
-      if (!shouldKeepInSymtab(Sec, B->getName(), *B))
+      if (!shouldKeepInSymtab(*DR))
         continue;
       In.SymTab->addSymbol(B);
     }




More information about the llvm-commits mailing list