Skip to content

Commit 1fba186

Browse files
[libclang] Migrate away from PointerUnion::dyn_cast (NFC) (llvm#125631)
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. Note that if Storage were null, dereferencing Ovl would trigger a segfault.
1 parent 63c59dd commit 1fba186

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clang/tools/libclang/CIndex.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5370,12 +5370,12 @@ CXString clang_getCursorSpelling(CXCursor C) {
53705370

53715371
case CXCursor_OverloadedDeclRef: {
53725372
OverloadedDeclRefStorage Storage = getCursorOverloadedDeclRef(C).first;
5373-
if (const Decl *D = Storage.dyn_cast<const Decl *>()) {
5373+
if (const Decl *D = dyn_cast<const Decl *>(Storage)) {
53745374
if (const NamedDecl *ND = dyn_cast<NamedDecl>(D))
53755375
return cxstring::createDup(ND->getNameAsString());
53765376
return cxstring::createEmpty();
53775377
}
5378-
if (const OverloadExpr *E = Storage.dyn_cast<const OverloadExpr *>())
5378+
if (const OverloadExpr *E = dyn_cast<const OverloadExpr *>(Storage))
53795379
return cxstring::createDup(E->getName().getAsString());
53805380
OverloadedTemplateStorage *Ovl =
53815381
cast<OverloadedTemplateStorage *>(Storage);

0 commit comments

Comments
 (0)