https://github.com/kazutakahirata created 
https://github.com/llvm/llvm-project/pull/231373

PointerUnion::dyn_cast has been soft-deprecated in favor of
llvm::dyn_cast and llvm::dyn_cast_if_present.  This patch replaces the
former with llvm::dyn_cast where the operand is guaranteed to be
nonnull.

ClassTemplateSpecializationDecl::getSpecializedTemplateOrPartial()
always returns a nonnull pointer by construction regardless of whether
the specialization is from a primary template or a partial
specialization.

Assisted-by: Antigravity


>From afca571227fd22361e5528a21ec647ccd909ef82 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <[email protected]>
Date: Mon, 12 Oct 2026 12:50:53 -0700
Subject: [PATCH] [clang] Replace PointerUnion::dyn_cast with llvm::dyn_cast
 (NFC)

PointerUnion::dyn_cast has been soft-deprecated in favor of
llvm::dyn_cast and llvm::dyn_cast_if_present.  This patch replaces the
former with llvm::dyn_cast where the operand is guaranteed to be
nonnull.

ClassTemplateSpecializationDecl::getSpecializedTemplateOrPartial()
always returns a nonnull pointer by construction regardless of whether
the specialization is from a primary template or a partial
specialization.

Assisted-by: Antigravity
---
 clang/lib/Index/IndexDecl.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Index/IndexDecl.cpp b/clang/lib/Index/IndexDecl.cpp
index 311beb68a3daf..8bcad4739c788 100644
--- a/clang/lib/Index/IndexDecl.cpp
+++ b/clang/lib/Index/IndexDecl.cpp
@@ -213,7 +213,7 @@ class IndexingDeclVisitor : public 
ConstDeclVisitor<IndexingDeclVisitor, bool> {
     llvm::PointerUnion<ClassTemplateDecl *,
                        ClassTemplatePartialSpecializationDecl *>
         Template = CTSD->getSpecializedTemplateOrPartial();
-    if (const auto *CTD = Template.dyn_cast<ClassTemplateDecl *>()) {
+    if (const auto *CTD = dyn_cast<ClassTemplateDecl *>(Template)) {
       const CXXRecordDecl *Pattern = CTD->getTemplatedDecl();
       bool TypeOverride = isa<TypeDecl>(D);
       for (const NamedDecl *ND : Pattern->lookup(D->getDeclName())) {

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to