[lld] r299492 - Make dummy variable's scope smaller.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 4 17:42:45 PDT 2017


Author: ruiu
Date: Tue Apr  4 19:42:45 2017
New Revision: 299492

URL: http://llvm.org/viewvc/llvm-project?rev=299492&view=rev
Log:
Make dummy variable's scope smaller.

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=299492&r1=299491&r2=299492&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Tue Apr  4 19:42:45 2017
@@ -136,15 +136,14 @@ static bool isUnderSysroot(StringRef Pat
 
 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,




More information about the llvm-commits mailing list