From b51ff2705fe15a214ba234dae221c39b105fa57c Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sun, 3 Aug 2025 16:05:34 -0700 Subject: MCSymbolELF: Migrate away from classof The object file format specific derived classes are used in context where the type is statically known. We don't use isa/dyn_cast and we want to eliminate MCSymbol::Kind in the base class. --- llvm/lib/MC/ELFObjectWriter.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'llvm/lib/MC/ELFObjectWriter.cpp') diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp index 76294ef..8f3814a 100644 --- a/llvm/lib/MC/ELFObjectWriter.cpp +++ b/llvm/lib/MC/ELFObjectWriter.cpp @@ -409,8 +409,7 @@ static bool isIFunc(const MCSymbolELF *Symbol) { void ELFWriter::writeSymbol(SymbolTableWriter &Writer, uint32_t StringIndex, ELFSymbolData &MSD) { auto &Symbol = static_cast(*MSD.Symbol); - const MCSymbolELF *Base = - cast_or_null(Asm.getBaseSymbol(Symbol)); + auto *Base = static_cast(Asm.getBaseSymbol(Symbol)); // This has to be in sync with when computeSymbolTable uses SHN_ABS or // SHN_COMMON. @@ -1317,7 +1316,7 @@ void ELFObjectWriter::recordRelocation(const MCFragment &F, auto &Section = static_cast(*F.getParent()); MCContext &Ctx = getContext(); - const auto *SymA = cast_or_null(Target.getAddSym()); + auto *SymA = static_cast(Target.getAddSym()); const MCSectionELF *SecA = (SymA && SymA->isInSection()) ? static_cast(&SymA->getSection()) -- cgit v1.1