Author: Kazu Hirata Date: 2025-01-29T07:48:06-08:00 New Revision: c583df46d404507f62c605b6f96cde22dcd9e948
URL: https://github.com/llvm/llvm-project/commit/c583df46d404507f62c605b6f96cde22dcd9e948 DIFF: https://github.com/llvm/llvm-project/commit/c583df46d404507f62c605b6f96cde22dcd9e948.diff LOG: [AST] Migrate away from PointerUnion::dyn_cast (NFC) (#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. Added: Modified: clang/lib/AST/ParentMapContext.cpp Removed: ################################################################################ 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