[lld] 2d7bfcd - ELF: Use dyn_cast to access sym field.
via llvm-commits
llvm-commits at lists.llvm.org
Tue May 5 18:09:02 PDT 2026
Author: Peter Collingbourne
Date: 2026-05-05T18:08:57-07:00
New Revision: 2d7bfcdd868a8c29ee567ef7eb5029fe825d175f
URL: https://github.com/llvm/llvm-project/commit/2d7bfcdd868a8c29ee567ef7eb5029fe825d175f
DIFF: https://github.com/llvm/llvm-project/commit/2d7bfcdd868a8c29ee567ef7eb5029fe825d175f.diff
LOG: ELF: Use dyn_cast to access sym field.
dyn_cast_or_null is unnecessary because this field is non-null.
Reviewers: MaskRay
Pull Request: https://github.com/llvm/llvm-project/pull/195785
Added:
Modified:
lld/ELF/Arch/TargetImpl.h
Removed:
################################################################################
diff --git a/lld/ELF/Arch/TargetImpl.h b/lld/ELF/Arch/TargetImpl.h
index 90a2b53cbb2af..0d4793afbb2ed 100644
--- a/lld/ELF/Arch/TargetImpl.h
+++ b/lld/ELF/Arch/TargetImpl.h
@@ -45,7 +45,7 @@ inline void applyBranchToBranchOptImpl(
[&getBranchInfoAtTarget](
Relocation &r,
uint64_t addend) -> std::pair<Relocation *, uint64_t> {
- auto *target = dyn_cast_or_null<Defined>(r.sym);
+ auto *target = dyn_cast<Defined>(r.sym);
// We don't allow preemptible symbols or ifuncs (may go somewhere else),
// absolute symbols (runtime behavior unknown), non-executable or writable
// memory (ditto) or non-regular sections (no section data).
More information about the llvm-commits
mailing list