Skip to content

Commit

Permalink
[MC] ELFObjectWriter: Removing unneeded variable and cast
Browse files Browse the repository at this point in the history
Differential Revision: https://reviews.llvm.org/D46289

llvm-svn: 331704
  • Loading branch information
sbc100 committed May 7, 2018
1 parent cdf8d06 commit 22c568b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions llvm/lib/MC/ELFObjectWriter.cpp
Expand Up @@ -200,7 +200,7 @@ class ELFObjectWriter : public MCObjectWriter {

bool shouldRelocateWithSymbol(const MCAssembler &Asm,
const MCSymbolRefExpr *RefA,
const MCSymbol *Sym, uint64_t C,
const MCSymbolELF *Sym, uint64_t C,
unsigned Type) const;

void recordRelocation(MCAssembler &Asm, const MCAsmLayout &Layout,
Expand Down Expand Up @@ -511,9 +511,9 @@ void ELFObjectWriter::writeSymbol(SymbolTableWriter &Writer,
// allows us to omit some local symbols from the symbol table.
bool ELFObjectWriter::shouldRelocateWithSymbol(const MCAssembler &Asm,
const MCSymbolRefExpr *RefA,
const MCSymbol *S, uint64_t C,
const MCSymbolELF *Sym,
uint64_t C,
unsigned Type) const {
const auto *Sym = cast_or_null<MCSymbolELF>(S);
// A PCRel relocation to an absolute value has no symbol (or section). We
// represent that with a relocation to a null section.
if (!RefA)
Expand Down Expand Up @@ -711,9 +711,8 @@ void ELFObjectWriter::recordRelocation(MCAssembler &Asm,
if (!RelocateWithSymbol) {
const MCSection *SecA =
(SymA && !SymA->isUndefined()) ? &SymA->getSection() : nullptr;
auto *ELFSec = cast_or_null<MCSectionELF>(SecA);
const auto *SectionSymbol =
ELFSec ? cast<MCSymbolELF>(ELFSec->getBeginSymbol()) : nullptr;
SecA ? cast<MCSymbolELF>(SecA->getBeginSymbol()) : nullptr;
if (SectionSymbol)
SectionSymbol->setUsedInReloc();
ELFRelocationEntry Rec(FixupOffset, SectionSymbol, Type, Addend, SymA,
Expand Down

0 comments on commit 22c568b

Please sign in to comment.