[clang] [analyzer] Add aggregate value tracking to the LifetimeModeling checker (PR #214823)
Benedek Kaibas via cfe-commits
cfe-commits at lists.llvm.org
Sun Aug 9 09:38:59 PDT 2026
================
@@ -105,6 +105,68 @@ std::string lifetime_modeling::getRegionName(const MemRegion *Reg) {
return "the region";
}
+namespace clang::ento::lifetime_modeling {
+
+static SmallVector<const MemRegion *, 4>
+getRegionsFromAggrVal(nonloc::LazyCompoundVal LCV, CheckerContext &C) {
+ SmallVector<const MemRegion *, 4> Reg;
+
+ const TypedValueRegion *LCVRegion = LCV.getRegion();
+ QualType T = LCVRegion->getValueType();
+ MemRegionManager &MemMgr = C.getSValBuilder().getRegionManager();
+ StoreManager &StoreMgr = C.getState()->getStateManager().getStoreManager();
+
+ // FIXME: getAsRecordDecl() also includes unions which need different
+ // handling. Reading a binding for every member of a union may produce regions
+ // that are not actually live.
+ if (const RecordDecl *RD = T->getAsRecordDecl()) {
----------------
benedekaibas wrote:
Array aggregates are not yet handled since `getAsRecordDecl` returns null in case of array aggregates. There is already a `FIXME` comment in the test file for the array field case. I have also added a FIXME comment in the function body, in this commit: [24bf85a](https://github.com/llvm/llvm-project/pull/214823/commits/24bf85a76ad73ec791534259fa4d7ebb5b0cc9bb)
https://github.com/llvm/llvm-project/pull/214823
More information about the cfe-commits
mailing list