[llvm] r331704 - [MC] ELFObjectWriter: Removing unneeded variable and cast

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Mon May 7 16:52:17 PDT 2018


Author: sbc
Date: Mon May  7 16:52:17 2018
New Revision: 331704

URL: http://llvm.org/viewvc/llvm-project?rev=331704&view=rev
Log:
[MC] ELFObjectWriter: Removing unneeded variable and cast

Differential Revision: https://reviews.llvm.org/D46289

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=331704&r1=331703&r2=331704&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Mon May  7 16:52:17 2018
@@ -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(Symbol
 // 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(M
   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,




More information about the llvm-commits mailing list