llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang-modules Author: Kazu Hirata (kazutakahirata) <details> <summary>Changes</summary> 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 on ExprWithCleanups::CleanupObject because it is always nonnull. Specifically, ExprWithCleanups::getObjects() is populated from a slice of Sema::ExprCleanupObjects, which only receives nonnull pointers in the following places: - Sema::BuildCompoundLiteralExpr - Sema::ActOnBlockStmtExpr - Sema::BuildBlockForLambdaConversion Assisted-by: Antigravity --- Full diff: https://github.com/llvm/llvm-project/pull/226390.diff 3 Files Affected: - (modified) clang/lib/AST/ASTImporter.cpp (+1-1) - (modified) clang/lib/CodeGen/CGBlocks.cpp (+1-1) - (modified) clang/lib/Serialization/ASTWriterStmt.cpp (+2-2) ``````````diff diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index bec73d820d009..091ad449f6144 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -9544,7 +9544,7 @@ void ASTImporter::RegisterImportedDecl(Decl *FromD, Decl *ToD) { llvm::Expected<ExprWithCleanups::CleanupObject> ASTImporter::Import(ExprWithCleanups::CleanupObject From) { - if (auto *CLE = From.dyn_cast<CompoundLiteralExpr *>()) { + if (auto *CLE = dyn_cast<CompoundLiteralExpr *>(From)) { if (Expected<Expr *> R = Import(CLE)) return ExprWithCleanups::CleanupObject(cast<CompoundLiteralExpr>(*R)); } diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp index 9edb9bc6bff71..d653df2b6c8b9 100644 --- a/clang/lib/CodeGen/CGBlocks.cpp +++ b/clang/lib/CodeGen/CGBlocks.cpp @@ -1094,7 +1094,7 @@ llvm::Value *CodeGenFunction::EmitBlockLiteral(const CGBlockInfo &blockInfo) { auto *EWC = llvm::dyn_cast_or_null<ExprWithCleanups>(RetExpr); if (EWC) for (auto &C : EWC->getObjects()) - if (auto *BD = C.dyn_cast<BlockDecl *>()) + if (auto *BD = dyn_cast<BlockDecl *>(C)) if (BD == blockDecl) return true; return false; diff --git a/clang/lib/Serialization/ASTWriterStmt.cpp b/clang/lib/Serialization/ASTWriterStmt.cpp index 8fdc75c208ada..249f1477a394c 100644 --- a/clang/lib/Serialization/ASTWriterStmt.cpp +++ b/clang/lib/Serialization/ASTWriterStmt.cpp @@ -2152,10 +2152,10 @@ void ASTStmtWriter::VisitExprWithCleanups(ExprWithCleanups *E) { VisitExpr(E); Record.push_back(E->getNumObjects()); for (auto &Obj : E->getObjects()) { - if (auto *BD = Obj.dyn_cast<BlockDecl *>()) { + if (auto *BD = dyn_cast<BlockDecl *>(Obj)) { Record.push_back(serialization::COK_Block); Record.AddDeclRef(BD); - } else if (auto *CLE = Obj.dyn_cast<CompoundLiteralExpr *>()) { + } else if (auto *CLE = dyn_cast<CompoundLiteralExpr *>(Obj)) { Record.push_back(serialization::COK_CompoundLiteral); Record.AddStmt(CLE); } `````````` </details> https://github.com/llvm/llvm-project/pull/226390 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
