Skip to content

Commit d2c7cab

Browse files
[Sema] Migrate away from PointerUnion::dyn_cast (NFC) (#124434)
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 EWC->getObject(i) to be nonnull.
1 parent 0f3c288 commit d2c7cab

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clang/lib/Sema/JumpDiagnostics.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,12 +561,12 @@ void JumpScopeChecker::BuildScopeInformation(Stmt *S,
561561
// implementable but a lot of work which we haven't felt up to doing.
562562
ExprWithCleanups *EWC = cast<ExprWithCleanups>(S);
563563
for (unsigned i = 0, e = EWC->getNumObjects(); i != e; ++i) {
564-
if (auto *BDecl = EWC->getObject(i).dyn_cast<BlockDecl *>())
564+
if (auto *BDecl = dyn_cast<BlockDecl *>(EWC->getObject(i)))
565565
for (const auto &CI : BDecl->captures()) {
566566
VarDecl *variable = CI.getVariable();
567567
BuildScopeInformation(variable, BDecl, origParentScope);
568568
}
569-
else if (auto *CLE = EWC->getObject(i).dyn_cast<CompoundLiteralExpr *>())
569+
else if (auto *CLE = dyn_cast<CompoundLiteralExpr *>(EWC->getObject(i)))
570570
BuildScopeInformation(CLE, origParentScope);
571571
else
572572
llvm_unreachable("unexpected cleanup object type");

0 commit comments

Comments
 (0)