[clang] a5159e2 - [AST] Migrate away from PointerUnion::dyn_cast (NFC) (#123890)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 22 00:15:49 PST 2025
Author: Kazu Hirata
Date: 2025-01-22T00:15:46-08:00
New Revision: a5159e200eb25c2873fb8db432962394a879e887
URL: https://github.com/llvm/llvm-project/commit/a5159e200eb25c2873fb8db432962394a879e887
DIFF: https://github.com/llvm/llvm-project/commit/a5159e200eb25c2873fb8db432962394a879e887.diff
LOG: [AST] Migrate away from PointerUnion::dyn_cast (NFC) (#123890)
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 TemplateOrSpecialization to be nonnull.
Added:
Modified:
clang/lib/AST/Decl.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index f641a72ed26448..a1a51d38b93e1f 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -4003,7 +4003,7 @@ const IdentifierInfo *FunctionDecl::getLiteralIdentifier() const {
FunctionDecl::TemplatedKind FunctionDecl::getTemplatedKind() const {
if (TemplateOrSpecialization.isNull())
return TK_NonTemplate;
- if (const auto *ND = TemplateOrSpecialization.dyn_cast<NamedDecl *>()) {
+ if (const auto *ND = dyn_cast<NamedDecl *>(TemplateOrSpecialization)) {
if (isa<FunctionDecl>(ND))
return TK_DependentNonTemplate;
assert(isa<FunctionTemplateDecl>(ND) &&
More information about the cfe-commits
mailing list