[clang] [AST] Migrate away from PointerUnion::dyn_cast (NFC) (PR #124446)
Kazu Hirata via cfe-commits
cfe-commits at lists.llvm.org
Sat Jan 25 21:47:30 PST 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/124446
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 Pattern to be nonnull.
>From fdbdd77ffa694347a7cba2869a1150e5ec599e6c Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 25 Jan 2025 09:17:15 -0800
Subject: [PATCH] [AST] Migrate away from PointerUnion::dyn_cast (NFC)
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 Pattern to be nonnull.
---
clang/lib/AST/DeclTemplate.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/lib/AST/DeclTemplate.cpp b/clang/lib/AST/DeclTemplate.cpp
index e4cb7dcb16a456..de81bc64106f18 100644
--- a/clang/lib/AST/DeclTemplate.cpp
+++ b/clang/lib/AST/DeclTemplate.cpp
@@ -1463,7 +1463,7 @@ SourceRange VarTemplateSpecializationDecl::getSourceRange() const {
assert(!Pattern.isNull() &&
"Variable template specialization without pattern?");
if (const auto *VTPSD =
- Pattern.dyn_cast<VarTemplatePartialSpecializationDecl *>())
+ dyn_cast<VarTemplatePartialSpecializationDecl *>(Pattern))
return VTPSD->getSourceRange();
VarTemplateDecl *VTD = cast<VarTemplateDecl *>(Pattern);
if (hasInit()) {
More information about the cfe-commits
mailing list