aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/ELFObjectWriter.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2025-08-03 16:05:34 -0700
committerFangrui Song <i@maskray.me>2025-08-03 16:05:35 -0700
commitb51ff2705fe15a214ba234dae221c39b105fa57c (patch)
treee8dc459d165d7cddcd3180505af1f14933d7b7a9 /llvm/lib/MC/ELFObjectWriter.cpp
parente640ca8b9adc390325e2c0406b0032dd24563c75 (diff)
downloadllvm-b51ff2705fe15a214ba234dae221c39b105fa57c.zip
llvm-b51ff2705fe15a214ba234dae221c39b105fa57c.tar.gz
llvm-b51ff2705fe15a214ba234dae221c39b105fa57c.tar.bz2
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.
Diffstat (limited to 'llvm/lib/MC/ELFObjectWriter.cpp')
-rw-r--r--llvm/lib/MC/ELFObjectWriter.cpp5
1 files changed, 2 insertions, 3 deletions
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<const MCSymbolELF &>(*MSD.Symbol);
- const MCSymbolELF *Base =
- cast_or_null<MCSymbolELF>(Asm.getBaseSymbol(Symbol));
+ auto *Base = static_cast<const MCSymbolELF *>(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<const MCSectionELF &>(*F.getParent());
MCContext &Ctx = getContext();
- const auto *SymA = cast_or_null<MCSymbolELF>(Target.getAddSym());
+ auto *SymA = static_cast<const MCSymbolELF *>(Target.getAddSym());
const MCSectionELF *SecA =
(SymA && SymA->isInSection())
? static_cast<const MCSectionELF *>(&SymA->getSection())