Author: Kazu Hirata
Date: 2026-10-13T00:24:37-07:00
New Revision: 6272b9d474fe813c51198dd7183ec467756ce421

URL: 
https://github.com/llvm/llvm-project/commit/6272b9d474fe813c51198dd7183ec467756ce421
DIFF: 
https://github.com/llvm/llvm-project/commit/6272b9d474fe813c51198dd7183ec467756ce421.diff

LOG: [clang] Replace PointerUnion::dyn_cast with llvm::dyn_cast (NFC) (#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

Added: 
    

Modified: 
    clang/lib/Index/IndexDecl.cpp

Removed: 
    


################################################################################
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