Author: Kazu Hirata Date: 2025-01-25T15:25:17-08:00 New Revision: d2c7cabe0453d6a6d03c15b7ae1800b53de9e182
URL: https://github.com/llvm/llvm-project/commit/d2c7cabe0453d6a6d03c15b7ae1800b53de9e182 DIFF: https://github.com/llvm/llvm-project/commit/d2c7cabe0453d6a6d03c15b7ae1800b53de9e182.diff LOG: [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. Added: Modified: clang/lib/Sema/JumpDiagnostics.cpp Removed: ################################################################################ diff --git a/clang/lib/Sema/JumpDiagnostics.cpp b/clang/lib/Sema/JumpDiagnostics.cpp index d465599450e7ff..4b92d67e49d7d7 100644 --- a/clang/lib/Sema/JumpDiagnostics.cpp +++ b/clang/lib/Sema/JumpDiagnostics.cpp @@ -561,12 +561,12 @@ void JumpScopeChecker::BuildScopeInformation(Stmt *S, // implementable but a lot of work which we haven't felt up to doing. ExprWithCleanups *EWC = cast<ExprWithCleanups>(S); for (unsigned i = 0, e = EWC->getNumObjects(); i != e; ++i) { - if (auto *BDecl = EWC->getObject(i).dyn_cast<BlockDecl *>()) + if (auto *BDecl = dyn_cast<BlockDecl *>(EWC->getObject(i))) for (const auto &CI : BDecl->captures()) { VarDecl *variable = CI.getVariable(); BuildScopeInformation(variable, BDecl, origParentScope); } - else if (auto *CLE = EWC->getObject(i).dyn_cast<CompoundLiteralExpr *>()) + else if (auto *CLE = dyn_cast<CompoundLiteralExpr *>(EWC->getObject(i))) BuildScopeInformation(CLE, origParentScope); else llvm_unreachable("unexpected cleanup object type"); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits