From 7f1c266e43aadc83ac8af55e99946289347f0215 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Wed, 11 Oct 2017 01:26:22 +0000 Subject: [PATCH] Move a loop invariant outside the loop. llvm-svn: 315404 --- lld/ELF/LinkerScript.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index ae413b5c5c26..1831c1603cb9 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -201,13 +201,12 @@ static std::string filename(InputFile *File) { } bool LinkerScript::shouldKeep(InputSectionBase *S) { - for (InputSectionDescription *ID : KeptSections) { - std::string Filename = filename(S->File); + std::string Filename = filename(S->File); + for (InputSectionDescription *ID : KeptSections) if (ID->FilePat.match(Filename)) for (SectionPattern &P : ID->SectionPatterns) if (P.SectionPat.match(S->Name)) return true; - } return false; } -- GitLab