[lld] r281901 - Remove unnecessary const_canst. NFC.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 19 17:15:20 PDT 2016


Ooh, I didn't notice I could've just done this. Thanks!

On Mon, Sep 19, 2016 at 6:33 AM, Rafael Espindola via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> 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/LinkerScri
> pt.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(Filen
> ame))
>          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);
>      }
>    }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160919/f0b6145d/attachment.html>


More information about the llvm-commits mailing list