[llvm] r207421 - Simplify isLocal().

Rafael Espindola rafael.espindola at gmail.com
Mon Apr 28 07:24:44 PDT 2014


Author: rafael
Date: Mon Apr 28 09:24:44 2014
New Revision: 207421

URL: http://llvm.org/viewvc/llvm-project?rev=207421&view=rev
Log:
Simplify isLocal().

No functionality change.

Modified:
    llvm/trunk/lib/MC/ELFObjectWriter.cpp

Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=207421&r1=207420&r2=207421&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Mon Apr 28 09:24:44 2014
@@ -109,8 +109,7 @@ class ELFObjectWriter : public MCObjectW
     static uint64_t SymbolValue(MCSymbolData &Data, const MCAsmLayout &Layout);
     static bool isInSymtab(const MCAsmLayout &Layout, const MCSymbolData &Data,
                            bool Used, bool Renamed);
-    static bool isLocal(const MCSymbolData &Data, bool isSignature,
-                        bool isUsedInReloc);
+    static bool isLocal(const MCSymbolData &Data, bool isUsedInReloc);
     static bool IsELFMetaDataSection(const MCSectionData &SD);
     static uint64_t DataSectionSize(const MCSectionData &SD);
     static uint64_t GetSectionFileSize(const MCAsmLayout &Layout,
@@ -971,20 +970,16 @@ bool ELFObjectWriter::isInSymtab(const M
   return true;
 }
 
-bool ELFObjectWriter::isLocal(const MCSymbolData &Data, bool isSignature,
-                              bool isUsedInReloc) {
+bool ELFObjectWriter::isLocal(const MCSymbolData &Data, bool isUsedInReloc) {
   if (Data.isExternal())
     return false;
 
   const MCSymbol &Symbol = Data.getSymbol();
-  const MCSymbol &RefSymbol = Symbol.AliasedSymbol();
-
-  if (RefSymbol.isUndefined() && !RefSymbol.isVariable()) {
-    if (isSignature && !isUsedInReloc)
-      return true;
+  if (Symbol.isDefined())
+    return true;
 
+  if (isUsedInReloc)
     return false;
-  }
 
   return true;
 }
@@ -1072,7 +1067,7 @@ ELFObjectWriter::computeSymbolTable(MCAs
 
     // Undefined symbols are global, but this is the first place we
     // are able to set it.
-    bool Local = isLocal(SD, isSignature, Used);
+    bool Local = isLocal(SD, Used);
     if (!Local && MCELF::GetBinding(SD) == ELF::STB_LOCAL) {
       assert(BaseSymbol);
       MCSymbolData &BaseData = Asm.getSymbolData(*BaseSymbol);





More information about the llvm-commits mailing list