From a08fa2eca355538b850abc6b450680253be6755d Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Wed, 5 Apr 2017 00:42:45 +0000 Subject: [PATCH] Make dummy variable's scope smaller. llvm-svn: 299492 --- 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 73d4dea19fbe..4eca9dd45ab6 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -136,15 +136,14 @@ static bool isUnderSysroot(StringRef Path) { OutputSection *LinkerScript::getOutputSection(const Twine &Loc, StringRef Name) { - static OutputSection FakeSec("", 0, 0); - for (OutputSection *Sec : *OutputSections) if (Sec->Name == Name) return Sec; + static OutputSection Dummy("", 0, 0); if (ErrorOnMissingSection) error(Loc + ": undefined section " + Name); - return &FakeSec; + return &Dummy; } // This function is essentially the same as getOutputSection(Name)->Size,