[clang] [analyzer] Implement LifetimeModeling checker and refactor UseAfterLifetimeEnd (PR #205951)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 30 03:45:03 PDT 2026


================
@@ -0,0 +1,21 @@
+#ifndef LLVM_CLANG_INCLUDE_STATICANALYZER_CHECKERS_LIFETIMEMODELING_H
+#define LLVM_CLANG_INCLUDE_STATICANALYZER_CHECKERS_LIFETIMEMODELING_H
+
+#include "clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h"
+#include <vector>
+
+namespace clang {
+namespace ento {
+namespace lifetimemodeling {
+
+std::vector<const MemRegion *> getLifetimeSourceSet(ProgramStateRef, SVal);
----------------
Xazax-hun wrote:

I wonder if we could make this API even more high level. Instead of returning a vector of memory regions maybe we just need to return a boolean if the pointer argument can point to deallocated memory. Parameters should have some names and these functions should have some documentation.

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


More information about the cfe-commits mailing list