[llvm] r237798 - MC: Use MCSymbol in MCObjectWriter::isWeak(), NFC
Duncan P. N. Exon Smith
dexonsmith at apple.com
Wed May 20 08:10:03 PDT 2015
Author: dexonsmith
Date: Wed May 20 10:10:03 2015
New Revision: 237798
URL: http://llvm.org/viewvc/llvm-project?rev=237798&view=rev
Log:
MC: Use MCSymbol in MCObjectWriter::isWeak(), NFC
Continue to prefer `MCSymbol` when we need both.
Modified:
llvm/trunk/include/llvm/MC/MCObjectWriter.h
llvm/trunk/lib/MC/ELFObjectWriter.cpp
llvm/trunk/lib/MC/MCExpr.cpp
llvm/trunk/lib/MC/MCObjectWriter.cpp
llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp
Modified: llvm/trunk/include/llvm/MC/MCObjectWriter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCObjectWriter.h?rev=237798&r1=237797&r2=237798&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCObjectWriter.h (original)
+++ llvm/trunk/include/llvm/MC/MCObjectWriter.h Wed May 20 10:10:03 2015
@@ -101,7 +101,7 @@ public:
/// \brief True if this symbol (which is a variable) is weak. This is not
/// just STB_WEAK, but more generally whether or not we can evaluate
/// past it.
- virtual bool isWeak(const MCSymbolData &SD) const;
+ virtual bool isWeak(const MCSymbol &Sym) const;
/// \brief Write the object file.
///
Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=237798&r1=237797&r2=237798&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Wed May 20 10:10:03 2015
@@ -250,7 +250,7 @@ class ELFObjectWriter : public MCObjectW
bool InSet,
bool IsPCRel) const override;
- bool isWeak(const MCSymbolData &SD) const override;
+ bool isWeak(const MCSymbol &Sym) const override;
void WriteObject(MCAssembler &Asm, const MCAsmLayout &Layout) override;
void writeSection(MCAssembler &Asm,
@@ -1478,7 +1478,8 @@ bool ELFObjectWriter::IsSymbolRefDiffere
InSet, IsPCRel);
}
-bool ELFObjectWriter::isWeak(const MCSymbolData &SD) const {
+bool ELFObjectWriter::isWeak(const MCSymbol &Sym) const {
+ const MCSymbolData &SD = Sym.getData();
if (::isWeak(SD))
return true;
@@ -1491,7 +1492,6 @@ bool ELFObjectWriter::isWeak(const MCSym
if (MCELF::GetBinding(SD) != ELF::STB_GLOBAL)
return false;
- const MCSymbol &Sym = SD.getSymbol();
if (!Sym.isInSection())
return false;
Modified: llvm/trunk/lib/MC/MCExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCExpr.cpp?rev=237798&r1=237797&r2=237798&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCExpr.cpp (original)
+++ llvm/trunk/lib/MC/MCExpr.cpp Wed May 20 10:10:03 2015
@@ -608,8 +608,7 @@ static bool canExpand(const MCSymbol &Sy
return true;
if (!Asm)
return false;
- const MCSymbolData &SD = Asm->getSymbolData(Sym);
- return !Asm->getWriter().isWeak(SD);
+ return !Asm->getWriter().isWeak(Sym);
}
bool MCExpr::EvaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
Modified: llvm/trunk/lib/MC/MCObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCObjectWriter.cpp?rev=237798&r1=237797&r2=237798&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/MCObjectWriter.cpp Wed May 20 10:10:03 2015
@@ -48,4 +48,4 @@ bool MCObjectWriter::IsSymbolRefDifferen
return &SecA == &SecB;
}
-bool MCObjectWriter::isWeak(const MCSymbolData &SD) const { return false; }
+bool MCObjectWriter::isWeak(const MCSymbol &) const { return false; }
Modified: llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp?rev=237798&r1=237797&r2=237798&view=diff
==============================================================================
--- llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp Wed May 20 10:10:03 2015
@@ -175,7 +175,7 @@ public:
const MCFragment &FB, bool InSet,
bool IsPCRel) const override;
- bool isWeak(const MCSymbolData &SD) const override;
+ bool isWeak(const MCSymbol &Sym) const override;
void RecordRelocation(MCAssembler &Asm, const MCAsmLayout &Layout,
const MCFragment *Fragment, const MCFixup &Fixup,
@@ -661,11 +661,11 @@ bool WinCOFFObjectWriter::IsSymbolRefDif
InSet, IsPCRel);
}
-bool WinCOFFObjectWriter::isWeak(const MCSymbolData &SD) const {
+bool WinCOFFObjectWriter::isWeak(const MCSymbol &Sym) const {
+ const MCSymbolData &SD = Sym.getData();
if (!SD.isExternal())
return false;
- const MCSymbol &Sym = SD.getSymbol();
if (!Sym.isInSection())
return false;
More information about the llvm-commits
mailing list