1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

MC: Use MCSymbol in MCObjectWriter::isWeak(), NFC

Continue to prefer `MCSymbol` when we need both.

llvm-svn: 237798
This commit is contained in:
Duncan P. N. Exon Smith 2015-05-20 15:10:03 +00:00
parent af6572aa97
commit 842194f532
5 changed files with 9 additions and 10 deletions

View File

@ -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.
///

View File

@ -250,7 +250,7 @@ class ELFObjectWriter : public MCObjectWriter {
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::IsSymbolRefDifferenceFullyResolvedImpl(
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 MCSymbolData &SD) const {
if (MCELF::GetBinding(SD) != ELF::STB_GLOBAL)
return false;
const MCSymbol &Sym = SD.getSymbol();
if (!Sym.isInSection())
return false;

View File

@ -608,8 +608,7 @@ static bool canExpand(const MCSymbol &Sym, const MCAssembler *Asm, bool InSet) {
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,

View File

@ -48,4 +48,4 @@ bool MCObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(
return &SecA == &SecB;
}
bool MCObjectWriter::isWeak(const MCSymbolData &SD) const { return false; }
bool MCObjectWriter::isWeak(const MCSymbol &) const { return false; }

View File

@ -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::IsSymbolRefDifferenceFullyResolvedImpl(
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;