From: Rafael Espindola Date: Mon, 19 Sep 2016 13:33:38 +0000 (+0000) Subject: Remove unnecessary const_canst. NFC. X-Git-Tag: llvmorg-4.0.0-rc1~9400 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f135f0ec1daa7779a7bcc49f232165d1f09f3fdc;p=platform%2Fupstream%2Fllvm.git Remove unnecessary const_canst. NFC. llvm-svn: 281901 --- diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index 7a326c4..e4f8378 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -109,12 +109,6 @@ bool LinkerScript::shouldKeep(InputSectionBase *S) { return false; } -// We need to use const_cast because match() is not a const function. -// This function encapsulates that ugliness. -static bool match(const Regex &Re, StringRef S) { - return const_cast(Re).match(S); -} - static bool comparePriority(InputSectionData *A, InputSectionData *B) { return getPriority(A->Name) < getPriority(B->Name); } @@ -170,13 +164,13 @@ void LinkerScript::computeInputSections(InputSectionDescription *I) { for (SectionPattern &Pat : I->SectionPatterns) { for (ObjectFile *F : Symtab::X->getObjectFiles()) { StringRef Filename = sys::path::filename(F->getName()); - if (!match(I->FileRe, Filename) || match(Pat.ExcludedFileRe, Filename)) + if (!I->FileRe.match(Filename) || Pat.ExcludedFileRe.match(Filename)) continue; for (InputSectionBase *S : F->getSections()) - if (!isDiscarded(S) && !S->OutSec && match(Pat.SectionRe, S->Name)) + if (!isDiscarded(S) && !S->OutSec && Pat.SectionRe.match(S->Name)) I->Sections.push_back(S); - if (match(Pat.SectionRe, "COMMON")) + if (Pat.SectionRe.match("COMMON")) I->Sections.push_back(CommonInputSection::X); } }