From c9f402eadc02d52371abb286790a0d4600e4b2d0 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Fri, 22 Apr 2016 00:23:52 +0000 Subject: [PATCH] Inline SectionRule::match. This short function was used only once and didn't provide much value. llvm-svn: 267086 --- lld/ELF/LinkerScript.cpp | 6 +----- lld/ELF/LinkerScript.h | 5 +---- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index 43d8022..9fcb2f61 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -165,7 +165,7 @@ uint64_t LinkerScript::evaluate(ArrayRef Tokens) { template StringRef LinkerScript::getOutputSection(InputSectionBase *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, StringRef T) { } } -template bool SectionRule::match(InputSectionBase *S) { - return matchStr(SectionPattern, S->getSectionName()); -} - class elf::ScriptParser : public ScriptParserBase { typedef void (ScriptParser::*Handler)(); diff --git a/lld/ELF/LinkerScript.h b/lld/ELF/LinkerScript.h index 5c07e7f..dfffb98 100644 --- a/lld/ELF/LinkerScript.h +++ b/lld/ELF/LinkerScript.h @@ -28,8 +28,7 @@ template class InputSectionBase; template 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 *S); uint64_t evaluate(ArrayRef Tokens); uint64_t parseExpr(ArrayRef &Tokens); -- 2.7.4