[clang] [analyzer][NFC] Factor out NoOwnershipChangeVisitor (PR #94357)
Mike Rice via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 25 13:35:28 PDT 2024
=?utf-8?q?Kristóf?= Umann <dkszelethus at gmail.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/94357 at github.com>
================
@@ -804,23 +751,21 @@ class NoOwnershipChangeVisitor final : public NoStateChangeFuncVisitor {
return false;
}
+ bool hasResourceStateChanged(ProgramStateRef CallEnterState,
+ ProgramStateRef CallExitEndState) final {
+ return CallEnterState->get<RegionState>(Sym) !=
+ CallExitEndState->get<RegionState>(Sym);
+ }
+
/// Heuristically guess whether the callee intended to free memory. This is
/// done syntactically, because we are trying to argue about alternative
/// paths of execution, and as a consequence we don't have path-sensitive
/// information.
- bool doesFnIntendToHandleOwnership(const Decl *Callee, ASTContext &ACtx) {
+ bool doesFnIntendToHandleOwnership(const Decl *Callee,
+ ASTContext &ACtx) final {
using namespace clang::ast_matchers;
const FunctionDecl *FD = dyn_cast<FunctionDecl>(Callee);
----------------
mikerice1969 wrote:
Following up on static verifier hits. This dyn_cast result is now not checked before it is dereferenced below (FD->getBody()). Should this be a cast instead? Or should there be a check before the dereference?
https://github.com/llvm/llvm-project/pull/94357
More information about the cfe-commits
mailing list