[clang] [analyzer][NFC] Factor out NoOwnershipChangeVisitor (PR #94357)

Kristóf Umann via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 26 02:07:09 PDT 2024


================
@@ -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);
----------------
Szelethus wrote:

Nice catch! Fix is here: https://github.com/llvm/llvm-project/pull/100719

https://github.com/llvm/llvm-project/pull/94357


More information about the cfe-commits mailing list