[llvm] [MC] Remove a redundant cast (NFC) (PR #168298)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 16 15:08:23 PST 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/168298

Symbol is already of type MCSymbolELF *.

Identified with readability-redundant-casting.


>From 40df608c427647ea1b9f6a033d44b68774129df9 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 16 Nov 2025 14:13:55 -0800
Subject: [PATCH] [MC] Remove a redundant cast (NFC)

Symbol is already of type MCSymbolELF *.

Identified with readability-redundant-casting.
---
 llvm/lib/MC/MCELFStreamer.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/llvm/lib/MC/MCELFStreamer.cpp b/llvm/lib/MC/MCELFStreamer.cpp
index 1bc1b92610871..973e98dd1fa29 100644
--- a/llvm/lib/MC/MCELFStreamer.cpp
+++ b/llvm/lib/MC/MCELFStreamer.cpp
@@ -271,8 +271,7 @@ void MCELFStreamer::emitCommonSymbol(MCSymbol *S, uint64_t Size,
                          " redeclared as different type");
   }
 
-  static_cast<MCSymbolELF *>(Symbol)->setSize(
-      MCConstantExpr::create(Size, getContext()));
+  Symbol->setSize(MCConstantExpr::create(Size, getContext()));
 }
 
 void MCELFStreamer::emitELFSize(MCSymbol *Symbol, const MCExpr *Value) {



More information about the llvm-commits mailing list