Author: Kazu Hirata Date: 2025-01-18T09:42:55-08:00 New Revision: 02a56c4d01c1621846d7342982d62468e45cede0
URL: https://github.com/llvm/llvm-project/commit/02a56c4d01c1621846d7342982d62468e45cede0 DIFF: https://github.com/llvm/llvm-project/commit/02a56c4d01c1621846d7342982d62468e45cede0.diff LOG: [AST] Migrate away from PointerUnion::dyn_cast (NFC) (#123444) 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 ValueOrInherited to be nonnull. Note that isSet checks to see if ValueOrInherited is nonnull. Added: Modified: clang/include/clang/AST/DeclTemplate.h Removed: ################################################################################ diff --git a/clang/include/clang/AST/DeclTemplate.h b/clang/include/clang/AST/DeclTemplate.h index d3a466a8617bb1..8c2da97c07a3bf 100644 --- a/clang/include/clang/AST/DeclTemplate.h +++ b/clang/include/clang/AST/DeclTemplate.h @@ -367,12 +367,11 @@ class DefaultArgStorage { if (!isSet()) ValueOrInherited = InheritedFrom; else if ([[maybe_unused]] auto *D = - ValueOrInherited.template dyn_cast<ParmDecl *>()) { + dyn_cast<ParmDecl *>(ValueOrInherited)) { assert(C.isSameDefaultTemplateArgument(D, InheritedFrom)); ValueOrInherited = new (allocateDefaultArgStorageChain(C)) Chain{InheritedFrom, get()}; - } else if (auto *Inherited = - ValueOrInherited.template dyn_cast<Chain *>()) { + } else if (auto *Inherited = dyn_cast<Chain *>(ValueOrInherited)) { assert(C.isSameDefaultTemplateArgument(Inherited->PrevDeclWithDefaultArg, InheritedFrom)); Inherited->PrevDeclWithDefaultArg = InheritedFrom; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits