<div dir="ltr">Ooh, I didn't notice I could've just done this. Thanks!<div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 19, 2016 at 6:33 AM, Rafael Espindola via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rafael<br>
Date: Mon Sep 19 08:33:38 2016<br>
New Revision: 281901<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=281901&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=281901&view=rev</a><br>
Log:<br>
Remove unnecessary const_canst. NFC.<br>
<br>
Modified:<br>
    lld/trunk/ELF/LinkerScript.cpp<br>
<br>
Modified: lld/trunk/ELF/LinkerScript.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=281901&r1=281900&r2=281901&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/ELF/LinkerScri<wbr>pt.cpp?rev=281901&r1=281900&<wbr>r2=281901&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/LinkerScript.cpp (original)<br>
+++ lld/trunk/ELF/LinkerScript.cpp Mon Sep 19 08:33:38 2016<br>
@@ -109,12 +109,6 @@ bool LinkerScript<ELFT>::shouldKeep<wbr>(Inpu<br>
   return false;<br>
 }<br>
<br>
-// We need to use const_cast because match() is not a const function.<br>
-// This function encapsulates that ugliness.<br>
-static bool match(const Regex &Re, StringRef S) {<br>
-  return const_cast<Regex &>(Re).match(S);<br>
-}<br>
-<br>
 static bool comparePriority(InputSectionDa<wbr>ta *A, InputSectionData *B) {<br>
   return getPriority(A->Name) < getPriority(B->Name);<br>
 }<br>
@@ -170,13 +164,13 @@ void LinkerScript<ELFT>::computeInp<wbr>utSec<br>
   for (SectionPattern &Pat : I->SectionPatterns) {<br>
     for (ObjectFile<ELFT> *F : Symtab<ELFT>::X->getObjectFile<wbr>s()) {<br>
       StringRef Filename = sys::path::filename(F->getName<wbr>());<br>
-      if (!match(I->FileRe, Filename) || match(Pat.ExcludedFileRe, Filename))<br>
+      if (!I->FileRe.match(Filename) || Pat.ExcludedFileRe.match(Filen<wbr>ame))<br>
         continue;<br>
<br>
       for (InputSectionBase<ELFT> *S : F->getSections())<br>
-        if (!isDiscarded(S) && !S->OutSec && match(Pat.SectionRe, S->Name))<br>
+        if (!isDiscarded(S) && !S->OutSec && Pat.SectionRe.match(S->Name))<br>
           I->Sections.push_back(S);<br>
-      if (match(Pat.SectionRe, "COMMON"))<br>
+      if (Pat.SectionRe.match("COMMON")<wbr>)<br>
         I->Sections.push_back(CommonI<wbr>nputSection<ELFT>::X);<br>
     }<br>
   }<br>
<br>
<br>
______________________________<wbr>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>