Skip to content

Commit c583df4

Browse files
[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.
1 parent a34a087 commit c583df4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

clang/lib/AST/ParentMapContext.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class ParentMapContext::ParentMap {
117117
if (I == Map.end()) {
118118
return llvm::ArrayRef<DynTypedNode>();
119119
}
120-
if (const auto *V = I->second.template dyn_cast<ParentVector *>()) {
120+
if (const auto *V = dyn_cast<ParentVector *>(I->second)) {
121121
return V->view();
122122
}
123123
return getSingleDynTypedNodeFromParentMap(I->second);
@@ -268,9 +268,9 @@ class ParentMapContext::ParentMap {
268268
auto It = PointerParents.find(E);
269269
if (It == PointerParents.end())
270270
break;
271-
const auto *S = It->second.dyn_cast<const Stmt *>();
271+
const auto *S = dyn_cast<const Stmt *>(It->second);
272272
if (!S) {
273-
if (auto *Vec = It->second.dyn_cast<ParentVector *>())
273+
if (auto *Vec = dyn_cast<ParentVector *>(It->second))
274274
return Vec->view();
275275
return getSingleDynTypedNodeFromParentMap(It->second);
276276
}

0 commit comments

Comments
 (0)