[lld] aaf0643 - [lld] Migrate away from PointerUnion::dyn_cast (NFC) (#123891)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 22 00:17:08 PST 2025
Author: Kazu Hirata
Date: 2025-01-22T00:17:04-08:00
New Revision: aaf0643dd5d09bdce12298e48310a2c979be5f9a
URL: https://github.com/llvm/llvm-project/commit/aaf0643dd5d09bdce12298e48310a2c979be5f9a
DIFF: https://github.com/llvm/llvm-project/commit/aaf0643dd5d09bdce12298e48310a2c979be5f9a.diff
LOG: [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.
Added:
Modified:
lld/MachO/SyntheticSections.cpp
Removed:
################################################################################
diff --git a/lld/MachO/SyntheticSections.cpp b/lld/MachO/SyntheticSections.cpp
index 417b7cf93efa7d..97164e5992b8c7 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<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?
More information about the llvm-commits
mailing list