[all-commits] [llvm/llvm-project] f0159c: [clang] Migrate away from PointerUnion::dyn_cast (...
Kazu Hirata via All-commits
all-commits at lists.llvm.org
Mon Sep 21 10:29:43 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: f0159c871942b821eb54f057a7739b4269f72b46
https://github.com/llvm/llvm-project/commit/f0159c871942b821eb54f057a7739b4269f72b46
Author: Kazu Hirata <kazu at google.com>
Date: 2026-09-21 (Mon, 21 Sep 2026)
Changed paths:
M clang/include/clang/AST/DeclContextInternals.h
M clang/include/clang/AST/DeclTemplate.h
M clang/include/clang/Basic/FileEntry.h
M clang/lib/AST/ASTImporter.cpp
M clang/lib/ASTMatchers/ASTMatchFinder.cpp
M clang/lib/Analysis/LifetimeSafety/Checker.cpp
M clang/lib/Analysis/LifetimeSafety/LiveOrigins.cpp
M clang/lib/Index/FileIndexRecord.cpp
M clang/lib/Sema/SemaConcept.cpp
M clang/lib/Sema/SemaSYCL.cpp
M clang/lib/Sema/SemaTemplateInstantiate.cpp
M clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
M clang/lib/Sema/SemaTemplateVariadic.cpp
M clang/lib/Serialization/ASTReaderStmt.cpp
M clang/lib/Serialization/ASTWriterDecl.cpp
M clang/lib/StaticAnalyzer/Core/BugSuppression.cpp
Log Message:
-----------
[clang] Migrate away from PointerUnion::dyn_cast (NFC) (#225022)
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
where the operands are known to be nonnull.
The operands are known to be nonnull in one of three ways:
- Preceding checks: A null check, assertion, or dereference a few
lines above guarantees the PointerUnion is nonnull.
- Downstream code: The else or fallthrough branch unconditionally
calls cast<...>, dereferences the pointer, or reaches
llvm_unreachable.
- By construction: In DeclContextInternals.h, FileEntry.h,
FileIndexRecord.cpp, and LifetimeSafety/Checker.cpp, only nonnull
pointers are ever stored in the PointerUnion.
Assisted-by: Antigravity
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list