[lld] Migrate away from PointerUnion::dyn_cast (NFC) (#123891)

Note that PointerUnion::dyn_cast has been soft deprecated in
PointerUnion.h:

  // FIXME: Replace the uses of is(), get() and dyn_cast() with
  //        isa<T>, cast<T> and the llvm::dyn_cast<T>

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<Symbol *>(rel.referent) to be true.
This commit is contained in:
Kazu Hirata
2025-01-22 00:17:04 -08:00
committed by GitHub
parent a5159e200e
commit aaf0643dd5

View File

@@ -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<Symbol *>();
const Symbol *referent = cast<Symbol *>(rel.referent);
assert(referent && "section relocation should have been rejected");
uint64_t offset = referent->getVA() - in.header->addr;
// FIXME: Can we handle this gracefully?