[clang] [AST] Migrate away from PointerUnion::dyn_cast (NFC) (PR #125335)
Kazu Hirata via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 31 22:07:48 PST 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/125335
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 InVectors.front() and P to be nonnull.
>From 327f04d3fd891d98ccef37622ef35d83d9f5c709 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 31 Jan 2025 10:24:38 -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 InVectors.front() and P to be nonnull.
---
clang/lib/AST/TemplateName.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/lib/AST/TemplateName.cpp b/clang/lib/AST/TemplateName.cpp
index 3a1eb1ca12f453..9e0a7dc2b8cdcb 100644
--- a/clang/lib/AST/TemplateName.cpp
+++ b/clang/lib/AST/TemplateName.cpp
@@ -144,7 +144,7 @@ TemplateName::TemplateName(DeducedTemplateStorage *Deduced)
bool TemplateName::isNull() const { return Storage.isNull(); }
TemplateName::NameKind TemplateName::getKind() const {
- if (auto *ND = Storage.dyn_cast<Decl *>()) {
+ if (auto *ND = dyn_cast<Decl *>(Storage)) {
if (isa<UsingShadowDecl>(ND))
return UsingTemplate;
assert(isa<TemplateDecl>(ND));
More information about the cfe-commits
mailing list