[clang] [LifetimeSafety] Read lifetimebound attribute on implicit 'this' from all redeclarations (PR #176188)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 15 08:10:28 PST 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Utkarsh Saxena (usx95)
<details>
<summary>Changes</summary>
Fix handling of `lifetimebound` attributes on implicit `this` parameters across function redeclarations.
Previously, the lifetime analysis would miss `lifetimebound` attributes on implicit `this` parameters if they were only present on certain redeclarations of a method. This could lead to false negatives in the lifetime safety analysis. This change ensures that if any redeclaration of a method has the attribute, it will be properly detected and used in the analysis.
I can't seem to work around the crash in the earlier attempt https://github.com/llvm/llvm-project/pull/172146.
---
Full diff: https://github.com/llvm/llvm-project/pull/176188.diff
5 Files Affected:
- (modified) clang/include/clang/Analysis/Analyses/LifetimeSafety/LifetimeAnnotations.h (+7)
- (modified) clang/lib/Analysis/LifetimeSafety/LifetimeAnnotations.cpp (+20-12)
- (modified) clang/test/Sema/warn-lifetime-analysis-nocfg.cpp (+138)
- (modified) clang/test/Sema/warn-lifetime-safety.cpp (+22)
- (modified) clang/test/SemaCXX/attr-lifetimebound.cpp (+21)
``````````diff
The server is unavailable at this time. Please wait a few minutes before you try again.
``````````
</details>
https://github.com/llvm/llvm-project/pull/176188
More information about the cfe-commits
mailing list