Skip to content

Commit 09e7b40

Browse files
[libclang] Migrate away from PointerUnion::dyn_cast (NFC) (#125381)
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 Storage to be nonnull.
1 parent 2767f4b commit 09e7b40

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

clang/tools/libclang/CIndex.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7415,11 +7415,11 @@ unsigned clang_getNumOverloadedDecls(CXCursor C) {
74157415
return 0;
74167416

74177417
OverloadedDeclRefStorage Storage = getCursorOverloadedDeclRef(C).first;
7418-
if (const OverloadExpr *E = Storage.dyn_cast<const OverloadExpr *>())
7418+
if (const OverloadExpr *E = dyn_cast<const OverloadExpr *>(Storage))
74197419
return E->getNumDecls();
74207420

74217421
if (OverloadedTemplateStorage *S =
7422-
Storage.dyn_cast<OverloadedTemplateStorage *>())
7422+
dyn_cast<OverloadedTemplateStorage *>(Storage))
74237423
return S->size();
74247424

74257425
const Decl *D = cast<const Decl *>(Storage);
@@ -7438,11 +7438,11 @@ CXCursor clang_getOverloadedDecl(CXCursor cursor, unsigned index) {
74387438

74397439
CXTranslationUnit TU = getCursorTU(cursor);
74407440
OverloadedDeclRefStorage Storage = getCursorOverloadedDeclRef(cursor).first;
7441-
if (const OverloadExpr *E = Storage.dyn_cast<const OverloadExpr *>())
7441+
if (const OverloadExpr *E = dyn_cast<const OverloadExpr *>(Storage))
74427442
return MakeCXCursor(E->decls_begin()[index], TU);
74437443

74447444
if (OverloadedTemplateStorage *S =
7445-
Storage.dyn_cast<OverloadedTemplateStorage *>())
7445+
dyn_cast<OverloadedTemplateStorage *>(Storage))
74467446
return MakeCXCursor(S->begin()[index], TU);
74477447

74487448
const Decl *D = cast<const Decl *>(Storage);

0 commit comments

Comments
 (0)