[PATCH] D46289: [MC] ELFObjectWriter: Removing unneeded variable and cast. NFC.

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 7 16:56:01 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL331704: [MC] ELFObjectWriter: Removing unneeded variable and cast (authored by sbc, committed by ).

Repository:
  rL LLVM

https://reviews.llvm.org/D46289

Files:
  llvm/trunk/lib/MC/ELFObjectWriter.cpp


Index: llvm/trunk/lib/MC/ELFObjectWriter.cpp
===================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp
@@ -200,7 +200,7 @@
 
   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 @@
 // 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 @@
   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,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46289.145595.patch
Type: text/x-patch
Size: 1836 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180507/30d4d848/attachment.bin>


More information about the llvm-commits mailing list