llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang-static-analyzer-1 Author: Donát Nagy (NagyDonat) <details> <summary>Changes</summary> When `ExprEngine::Visit` visits a statement, it usually first invokes the `PreStmt` callbacks, then performs the statement-specific visitation logic, then finally invokes the `PostStmt` callbacks. Before this commit, `CXXDeleteExpr` did not follow this regular pattern, because it invoked the `PostStmt` callbacks before the statement-specific logic. This exceptional logic was introduced in 2020 by commit 9d69072fb80755a0029a01c74892b4bf03f20f65 and I confirmed with the author of that commit that the unusual order is not intentional -- it is just an accidental mistake. This commit ensures that `CXXDeleteExpr` also follows the standard order by swapping the `PostStmt` step and the `VisitCXXDeleteExpr()` call. As no (upstream) checkers use the `PostStmt<CXXDeleteExpr>` callback, this is -- in practice -- a non-functional change. (The inconsistency was spotted by Gábor Tóthvári in the source code.) --- Full diff: https://github.com/llvm/llvm-project/pull/215828.diff 1 Files Affected: - (modified) clang/lib/StaticAnalyzer/Core/ExprEngine.cpp (+4-4) ``````````diff diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp index 328ed5b23dd83..dd1088d1aaafb 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -2133,12 +2133,12 @@ void ExprEngine::Visit(const Stmt *S, ExplodedNode *Pred, ExplodedNodeSet PreVisit; const auto *CDE = cast<CXXDeleteExpr>(S); getCheckerManager().runCheckersForPreStmt(PreVisit, Pred, S, *this); - ExplodedNodeSet PostVisit; - getCheckerManager().runCheckersForPostStmt(PostVisit, PreVisit, S, *this); - for (const auto i : PostVisit) - VisitCXXDeleteExpr(CDE, i, Dst); + ExplodedNodeSet PostVisit; + for (const auto i : PreVisit) + VisitCXXDeleteExpr(CDE, i, PostVisit); + getCheckerManager().runCheckersForPostStmt(Dst, PostVisit, S, *this); break; } // FIXME: ChooseExpr is really a constant. We need to fix `````````` </details> https://github.com/llvm/llvm-project/pull/215828 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
