Skip to content

Commit c216081

Browse files
[AST] Migrate away from PointerUnion::dyn_cast (NFC) (#124388)
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 P to be nonnull.
1 parent f607e3f commit c216081

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clang/lib/AST/DeclTemplate.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,7 @@ ClassTemplateSpecializationDecl::getSourceRange() const {
10491049
assert(!Pattern.isNull() &&
10501050
"Class template specialization without pattern?");
10511051
if (const auto *CTPSD =
1052-
Pattern.dyn_cast<ClassTemplatePartialSpecializationDecl *>())
1052+
dyn_cast<ClassTemplatePartialSpecializationDecl *>(Pattern))
10531053
return CTPSD->getSourceRange();
10541054
return cast<ClassTemplateDecl *>(Pattern)->getSourceRange();
10551055
}
@@ -1773,7 +1773,7 @@ TemplateParameterList *clang::getReplacedTemplateParameterList(Decl *D) {
17731773
const auto *CTSD = cast<ClassTemplateSpecializationDecl>(D);
17741774
auto P = CTSD->getSpecializedTemplateOrPartial();
17751775
if (const auto *CTPSD =
1776-
P.dyn_cast<ClassTemplatePartialSpecializationDecl *>())
1776+
dyn_cast<ClassTemplatePartialSpecializationDecl *>(P))
17771777
return CTPSD->getTemplateParameters();
17781778
return cast<ClassTemplateDecl *>(P)->getTemplateParameters();
17791779
}

0 commit comments

Comments
 (0)