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

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 dyn_cast
because we expect referent to be nonnull.
This commit is contained in:
Kazu Hirata 2025-02-03 12:28:14 -08:00 committed by GitHub
parent 90dd964328
commit 8686e677ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -32,7 +32,7 @@ InputSection *Reloc::getReferentInputSection() const {
}
StringRef Reloc::getReferentString() const {
if (auto *isec = referent.dyn_cast<InputSection *>()) {
if (auto *isec = dyn_cast<InputSection *>(referent)) {
const auto *cisec = dyn_cast<CStringInputSection>(isec);
assert(cisec && "referent must be a CStringInputSection");
return cisec->getStringRefAtOffset(addend);