[llvm-branch-commits] [clang] [analyzer] Only bind aggregate lifetime sources in LifetimeModeling for annotated functions (PR #214824)

Balázs Benics via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Aug 9 09:06:29 PDT 2026


================
@@ -180,11 +191,13 @@ void LifetimeModeling::checkPostCall(const CallEvent &Call,
     return;
 
   SVal RetVal = Call.getReturnValue();
-  SmallVector<const MemRegion *, 4> AggrRegs =
-      lifetime_modeling::getRegionsFromAggrVal(RetVal, C);
 
-  for (const MemRegion *I : AggrRegs) {
-    State = bindSource(State, RetVal, I);
+  if (isAnnotated(FD)) {
+    SmallVector<const MemRegion *, 4> AggrRegs =
+        lifetime_modeling::getRegionsFromAggrVal(RetVal, C);
+    for (const MemRegion *I : AggrRegs) {
+      State = bindSource(State, RetVal, I);
+    }
----------------
steakhal wrote:

```suggestion
    auto AggrRegs = lifetime_modeling::getRegionsFromAggrVal(RetVal, C);
    for (const MemRegion *R : AggrRegs) {
      State = bindSource(State, RetVal, R);
    }
```

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


More information about the llvm-branch-commits mailing list