mirror of
https://github.com/intel/llvm.git
synced 2026-01-20 10:58:11 +08:00
[lld] Migrate away from PointerUnion::{is,get} (NFC) (#119993)
Note that PointerUnion::{is,get} have 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>
I'm not touching PointerUnion::dyn_cast for now because it's a bit
complicated; we could blindly migrate it to dyn_cast_if_present, but
we should probably use dyn_cast when the operand is known to be
non-null.
This commit is contained in:
@@ -226,13 +226,13 @@ void ConcatInputSection::writeTo(uint8_t *buf) {
|
||||
const bool needsFixup = config->emitChainedFixups &&
|
||||
target->hasAttr(r.type, RelocAttrBits::UNSIGNED);
|
||||
if (target->hasAttr(r.type, RelocAttrBits::SUBTRAHEND)) {
|
||||
const Symbol *fromSym = r.referent.get<Symbol *>();
|
||||
const Symbol *fromSym = cast<Symbol *>(r.referent);
|
||||
const Reloc &minuend = relocs[++i];
|
||||
uint64_t minuendVA;
|
||||
if (const Symbol *toSym = minuend.referent.dyn_cast<Symbol *>())
|
||||
minuendVA = toSym->getVA() + minuend.addend;
|
||||
else {
|
||||
auto *referentIsec = minuend.referent.get<InputSection *>();
|
||||
auto *referentIsec = cast<InputSection *>(minuend.referent);
|
||||
assert(!::shouldOmitFromOutput(referentIsec));
|
||||
minuendVA = referentIsec->getVA(minuend.addend);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user