[clang] 0f3c288 - [AST] Migrate away from PointerUnion::dyn_cast (NFC) (#124433)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Jan 25 15:25:08 PST 2025
Author: Kazu Hirata
Date: 2025-01-25T15:25:04-08:00
New Revision: 0f3c2884f3ccbdbe396e4388feb8be716b50dd68
URL: https://github.com/llvm/llvm-project/commit/0f3c2884f3ccbdbe396e4388feb8be716b50dd68
DIFF: https://github.com/llvm/llvm-project/commit/0f3c2884f3ccbdbe396e4388feb8be716b50dd68.diff
LOG: [AST] Migrate away from PointerUnion::dyn_cast (NFC) (#124433)
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 U to be nonnull.
Added:
Modified:
clang/lib/AST/ParentMapContext.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/ParentMapContext.cpp b/clang/lib/AST/ParentMapContext.cpp
index af7d9fcdc638be..7ff492443031dc 100644
--- a/clang/lib/AST/ParentMapContext.cpp
+++ b/clang/lib/AST/ParentMapContext.cpp
@@ -103,9 +103,9 @@ class ParentMapContext::ParentMap {
static DynTypedNode
getSingleDynTypedNodeFromParentMap(ParentMapPointers::mapped_type U) {
- if (const auto *D = U.dyn_cast<const Decl *>())
+ if (const auto *D = dyn_cast<const Decl *>(U))
return DynTypedNode::create(*D);
- if (const auto *S = U.dyn_cast<const Stmt *>())
+ if (const auto *S = dyn_cast<const Stmt *>(U))
return DynTypedNode::create(*S);
return *cast<DynTypedNode *>(U);
}
More information about the cfe-commits
mailing list