[lld] 8686e67 - [lld] Migrate away from PointerUnion::dyn_cast (NFC) (#125458)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 3 12:28:17 PST 2025
Author: Kazu Hirata
Date: 2025-02-03T12:28:14-08:00
New Revision: 8686e677fffabab4c104e16559aaa9c7b0a6b679
URL: https://github.com/llvm/llvm-project/commit/8686e677fffabab4c104e16559aaa9c7b0a6b679
DIFF: https://github.com/llvm/llvm-project/commit/8686e677fffabab4c104e16559aaa9c7b0a6b679.diff
LOG: [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.
Added:
Modified:
lld/MachO/Relocations.cpp
Removed:
################################################################################
diff --git a/lld/MachO/Relocations.cpp b/lld/MachO/Relocations.cpp
index aac0e1bd3c9e0cd..78cc13388d6eb66 100644
--- a/lld/MachO/Relocations.cpp
+++ b/lld/MachO/Relocations.cpp
@@ -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);
More information about the llvm-commits
mailing list