aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/ELFObjectWriter.cpp
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2018-05-07 23:52:17 +0000
committerSam Clegg <sbc@chromium.org>2018-05-07 23:52:17 +0000
commit22c568ba73227bd4aa2abb34d9d7f3f1ecc37e2c (patch)
treea138cc407f67d6573c57e95f15d6feb3db9c45b4 /llvm/lib/MC/ELFObjectWriter.cpp
parentcdf8d06426318da7b1a0e6f43d088b1623103d10 (diff)
downloadllvm-22c568ba73227bd4aa2abb34d9d7f3f1ecc37e2c.zip
llvm-22c568ba73227bd4aa2abb34d9d7f3f1ecc37e2c.tar.gz
llvm-22c568ba73227bd4aa2abb34d9d7f3f1ecc37e2c.tar.bz2
[MC] ELFObjectWriter: Removing unneeded variable and cast
Differential Revision: https://reviews.llvm.org/D46289 llvm-svn: 331704
Diffstat (limited to 'llvm/lib/MC/ELFObjectWriter.cpp')
-rw-r--r--llvm/lib/MC/ELFObjectWriter.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp
index 85bbcab..ec4f86f 100644
--- a/llvm/lib/MC/ELFObjectWriter.cpp
+++ b/llvm/lib/MC/ELFObjectWriter.cpp
@@ -200,7 +200,7 @@ public:
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,
@@ -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)
@@ -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,