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

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


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-mc

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>

Symbol is already of type MCSymbolELF *.

Identified with readability-redundant-casting.


---
Full diff: https://github.com/llvm/llvm-project/pull/168298.diff


1 Files Affected:

- (modified) llvm/lib/MC/MCELFStreamer.cpp (+1-2) 


``````````diff
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) {

``````````

</details>


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


More information about the llvm-commits mailing list