[clang] [analyzer] Discard non-live source frames from the current stack (PR #213779)
Benedek Kaibas via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 4 06:17:16 PDT 2026
================
@@ -52,7 +52,17 @@ static bool isDanglingStackSource(const MemRegion *Source,
})) {
return false;
}
-
+ // Only a source whose frame is still live on the current stack can
+ // dangle. If that frame is not on the stack then the source outlives
+ // the returned value. The source is still alive when the returned value
+ // is used, so it does not dangle.
+ /*
+ if (llvm::any_of(C.stackframes(), [&](const StackFrame &Frame) {
+ if (&Frame != SF)
+ return false;
+ return true;
----------------
benedekaibas wrote:
This makes it easier to read, applied changes here: [3eff8e8](https://github.com/llvm/llvm-project/pull/213779/commits/3eff8e8af97477b9400549b13b2e7a4e6ada2fe3)
https://github.com/llvm/llvm-project/pull/213779
More information about the cfe-commits
mailing list