https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/124882
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 It->second to be nonnull. getSingleDynTypedNodeFromParentMap ends with a deference of U. >From 73f451de71115dcf4b5350194ccd01ab12a66729 Mon Sep 17 00:00:00 2001 From: Kazu Hirata <k...@google.com> Date: Tue, 28 Jan 2025 17:04:10 -0800 Subject: [PATCH] [AST] 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 because we expect It->second to be nonnull. getSingleDynTypedNodeFromParentMap ends with a deference of U. --- clang/lib/AST/ParentMapContext.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/lib/AST/ParentMapContext.cpp b/clang/lib/AST/ParentMapContext.cpp index 7ff492443031dc..2e77e1d7c4c644 100644 --- a/clang/lib/AST/ParentMapContext.cpp +++ b/clang/lib/AST/ParentMapContext.cpp @@ -117,7 +117,7 @@ class ParentMapContext::ParentMap { if (I == Map.end()) { return llvm::ArrayRef<DynTypedNode>(); } - if (const auto *V = I->second.template dyn_cast<ParentVector *>()) { + if (const auto *V = dyn_cast<ParentVector *>(I->second)) { return V->view(); } return getSingleDynTypedNodeFromParentMap(I->second); @@ -268,9 +268,9 @@ class ParentMapContext::ParentMap { auto It = PointerParents.find(E); if (It == PointerParents.end()) break; - const auto *S = It->second.dyn_cast<const Stmt *>(); + const auto *S = dyn_cast<const Stmt *>(It->second); if (!S) { - if (auto *Vec = It->second.dyn_cast<ParentVector *>()) + if (auto *Vec = dyn_cast<ParentVector *>(It->second)) return Vec->view(); return getSingleDynTypedNodeFromParentMap(It->second); } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits