Skip to content

Conversation

@kazutakahirata
Copy link
Contributor

Symbol is already of type MCSymbolELF *.

Identified with readability-redundant-casting.

Symbol is already of type MCSymbolELF *.

Identified with readability-redundant-casting.
@llvmbot llvmbot added the llvm:mc Machine (object) code label Nov 16, 2025
@llvmbot
Copy link
Member

llvmbot commented Nov 16, 2025

@llvm/pr-subscribers-llvm-mc

Author: Kazu Hirata (kazutakahirata)

Changes

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

Copy link
Contributor

@s-barannikov s-barannikov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kazutakahirata kazutakahirata merged commit 11278cf into llvm:main Nov 17, 2025
12 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_20251116a_clang_tidy_readability-redundant-casting_MC branch November 17, 2025 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

llvm:mc Machine (object) code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants