[lld] r267086 - Inline SectionRule::match.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 21 17:23:53 PDT 2016


Author: ruiu
Date: Thu Apr 21 19:23:52 2016
New Revision: 267086

URL: http://llvm.org/viewvc/llvm-project?rev=267086&view=rev
Log:
Inline SectionRule::match.

This short function was used only once and didn't provide much value.

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

Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=267086&r1=267085&r2=267086&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Thu Apr 21 19:23:52 2016
@@ -165,7 +165,7 @@ uint64_t LinkerScript<ELFT>::evaluate(Ar
 template <class ELFT>
 StringRef LinkerScript<ELFT>::getOutputSection(InputSectionBase<ELFT> *S) {
   for (SectionRule &R : Opt.Sections)
-    if (R.match(S))
+    if (matchStr(R.SectionPattern, S->getSectionName()))
       return R.Dest;
   return "";
 }
@@ -296,10 +296,6 @@ static bool matchStr(StringRef S, String
   }
 }
 
-template <class ELFT> bool SectionRule::match(InputSectionBase<ELFT> *S) {
-  return matchStr(SectionPattern, S->getSectionName());
-}
-
 class elf::ScriptParser : public ScriptParserBase {
   typedef void (ScriptParser::*Handler)();
 

Modified: lld/trunk/ELF/LinkerScript.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.h?rev=267086&r1=267085&r2=267086&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.h (original)
+++ lld/trunk/ELF/LinkerScript.h Thu Apr 21 19:23:52 2016
@@ -28,8 +28,7 @@ template <class ELFT> class InputSection
 template <class ELFT> class OutputSectionBase;
 
 // This class represents each rule in SECTIONS command.
-class SectionRule {
-public:
+struct SectionRule {
   SectionRule(StringRef D, StringRef S)
       : Dest(D), SectionPattern(S) {}
 
@@ -38,7 +37,6 @@ public:
 
   StringRef Dest;
 
-private:
   StringRef SectionPattern;
 };
 
@@ -90,7 +88,6 @@ private:
   ScriptConfiguration &Opt = *ScriptConfig;
 
   int getSectionIndex(StringRef Name);
-  SectionRule *find(InputSectionBase<ELFT> *S);
 
   uint64_t evaluate(ArrayRef<StringRef> Tokens);
   uint64_t parseExpr(ArrayRef<StringRef> &Tokens);




More information about the llvm-commits mailing list