https://github.com/kazutakahirata created
https://github.com/llvm/llvm-project/pull/228673
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.
Note that:
assert(ClassTemplSpec->getSpecializedTemplate() && ...);
a few lines above guarantees that
ClassTemplSpec->getSpecializedTemplateOrPartial() is nonnull.
Assisted-by: Antigravity
>From 4e07c9e9c90691f43826e594b01249fa9548b816 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <[email protected]>
Date: Sun, 20 Sep 2026 15:29:53 -0700
Subject: [PATCH] [clang] 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.
Note that:
assert(ClassTemplSpec->getSpecializedTemplate() && ...);
a few lines above guarantees that
ClassTemplSpec->getSpecializedTemplateOrPartial() is nonnull.
Assisted-by: Antigravity
---
clang/lib/Sema/SemaTemplateInstantiate.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp
b/clang/lib/Sema/SemaTemplateInstantiate.cpp
index 06ea12ca7bd73b..036642f22bd8cb 100644
--- a/clang/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp
@@ -257,8 +257,8 @@ HandleClassTemplateSpec(const
ClassTemplateSpecializationDecl *ClassTemplSpec,
// specialization, as the ClassTemplateSpecializationDecl's
// DeclContext/LexicalDeclContext will be for the primary template.
if (auto *InstFromPartialTempl =
- ClassTemplSpec->getSpecializedTemplateOrPartial()
- .dyn_cast<ClassTemplatePartialSpecializationDecl *>())
+ dyn_cast<ClassTemplatePartialSpecializationDecl *>(
+ ClassTemplSpec->getSpecializedTemplateOrPartial()))
return Response::ChangeDecl(
InstFromPartialTempl->getLexicalDeclContext());
}
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits