[lld] r281901 - Remove unnecessary const_canst. NFC.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 19 06:33:39 PDT 2016


Author: rafael
Date: Mon Sep 19 08:33:38 2016
New Revision: 281901

URL: http://llvm.org/viewvc/llvm-project?rev=281901&view=rev
Log:
Remove unnecessary const_canst. NFC.

Modified:
    lld/trunk/ELF/LinkerScript.cpp

Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=281901&r1=281900&r2=281901&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Mon Sep 19 08:33:38 2016
@@ -109,12 +109,6 @@ bool LinkerScript<ELFT>::shouldKeep(Inpu
   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<Regex &>(Re).match(S);
-}
-
 static bool comparePriority(InputSectionData *A, InputSectionData *B) {
   return getPriority(A->Name) < getPriority(B->Name);
 }
@@ -170,13 +164,13 @@ void LinkerScript<ELFT>::computeInputSec
   for (SectionPattern &Pat : I->SectionPatterns) {
     for (ObjectFile<ELFT> *F : Symtab<ELFT>::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<ELFT> *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<ELFT>::X);
     }
   }




More information about the llvm-commits mailing list