From df67708b97d7000606b42bc868f0640dd1e0a96e Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Tue, 21 Jan 2025 13:27:22 -0800 Subject: [PATCH] [lld] Migrate away from PointerUnion::dyn_cast (NFC) Note that PointerUnion::dyn_cast has been soft deprecated in PointerUnion.h: // FIXME: Replace the uses of is(), get() and dyn_cast() with // isa, cast and the llvm::dyn_cast Literal migration would result in dyn_cast_if_present (see the definition of PointerUnion::dyn_cast), but this patch uses cast because we know expect isa(rel.referent) to be true. --- lld/MachO/SyntheticSections.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lld/MachO/SyntheticSections.cpp b/lld/MachO/SyntheticSections.cpp index 417b7cf93efa7..97164e5992b8c 100644 --- a/lld/MachO/SyntheticSections.cpp +++ b/lld/MachO/SyntheticSections.cpp @@ -1958,7 +1958,7 @@ void InitOffsetsSection::writeTo(uint8_t *buf) const { // FIXME: Add function specified by -init when that argument is implemented. for (ConcatInputSection *isec : sections) { for (const Reloc &rel : isec->relocs) { - const Symbol *referent = rel.referent.dyn_cast(); + const Symbol *referent = cast(rel.referent); assert(referent && "section relocation should have been rejected"); uint64_t offset = referent->getVA() - in.header->addr; // FIXME: Can we handle this gracefully?