[clang] [clang] Migrate away from PointerUnion::dyn_cast (NFC) (PR #228673)
https://github.com/kazutakahirata closed https://github.com/llvm/llvm-project/pull/228673 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Migrate away from PointerUnion::dyn_cast (NFC) (PR #228673)
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, cast and the llvm::dyn_cast 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 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, cast and the llvm::dyn_cast 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()) +dyn_cast( +ClassTemplSpec->getSpecializedTemplateOrPartial())) return Response::ChangeDecl( InstFromPartialTempl->getLexicalDeclContext()); } ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Migrate away from PointerUnion::dyn_cast (NFC) (PR #228673)
llvmorg-github-actions[bot] wrote: @llvm/pr-subscribers-clang Author: Kazu Hirata (kazutakahirata) Changes Note that PointerUnion::dyn_cast has been soft deprecated in PointerUnion.h: // FIXME: Replace the uses of is(), get() and dyn_cast() with //isa, cast and the llvm::dyn_cast 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 --- Full diff: https://github.com/llvm/llvm-project/pull/228673.diff 1 Files Affected: - (modified) clang/lib/Sema/SemaTemplateInstantiate.cpp (+2-2) ``diff diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index 06ea12ca7bd73..036642f22bd8c 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()) +dyn_cast( +ClassTemplSpec->getSpecializedTemplateOrPartial())) return Response::ChangeDecl( InstFromPartialTempl->getLexicalDeclContext()); } `` https://github.com/llvm/llvm-project/pull/228673 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Migrate away from PointerUnion::dyn_cast (NFC) (PR #228673)
https://github.com/nikic approved this pull request. https://github.com/llvm/llvm-project/pull/228673 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
