Skip to content

Commit b4ef11d

Browse files
[AST] Migrate away from PointerUnion::dyn_cast (NFC) (#124228)
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 Source to be nonnull.
1 parent 1fa5603 commit b4ef11d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

clang/lib/AST/ByteCode/Descriptor.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -428,17 +428,17 @@ QualType Descriptor::getElemQualType() const {
428428
}
429429

430430
SourceLocation Descriptor::getLocation() const {
431-
if (auto *D = Source.dyn_cast<const Decl *>())
431+
if (auto *D = dyn_cast<const Decl *>(Source))
432432
return D->getLocation();
433-
if (auto *E = Source.dyn_cast<const Expr *>())
433+
if (auto *E = dyn_cast<const Expr *>(Source))
434434
return E->getExprLoc();
435435
llvm_unreachable("Invalid descriptor type");
436436
}
437437

438438
SourceInfo Descriptor::getLoc() const {
439-
if (const auto *D = Source.dyn_cast<const Decl *>())
439+
if (const auto *D = dyn_cast<const Decl *>(Source))
440440
return SourceInfo(D);
441-
if (const auto *E = Source.dyn_cast<const Expr *>())
441+
if (const auto *E = dyn_cast<const Expr *>(Source))
442442
return SourceInfo(E);
443443
llvm_unreachable("Invalid descriptor type");
444444
}

0 commit comments

Comments
 (0)