[clang] [analyzer] Implemented a base of detecing lifetimebound annotation (PR #200145)
Benedek Kaibas via cfe-commits
cfe-commits at lists.llvm.org
Fri May 29 07:24:26 PDT 2026
benedekaibas wrote:
As I was working on fixing:
> I think, if the annotated function returns by value (r-value), then the return value wouldn't be a MemRegion.
I have switched the key-value in the program state map: `REGISTER_MAP_WITH_PROGRAMSTATE(LifetimeBoundMap, SVal, const MemRegion *);`
Also rewritten the code parts where it was needed to get the region of the `SVal` instead of the `MemRegion`. When I tried to build my changes I have encountered the following issue:
```
/home/benedek-kaibas/Documents/llvm-project/llvm/include/llvm/ADT/ImmutableSet.h:940:33: required from ‘static bool llvm::ImutContainerInfo<T>::isLess(key_type_ref, key_type_ref) [with T = clang::ento::SVal; key_type_ref = const clang::ento::SVal&]’
```
`SVal` misses the ordering operator that `REGISTER_MAP_WITH_PROGRAMSTATE` requires on the key. Also I have looked up existing checkers to see if any of them takes `SVal` in their program state register as key, but I could not find one as of now. This is where I am stuck right now.
I am wondering if you have any suggestions for this?
https://github.com/llvm/llvm-project/pull/200145
More information about the cfe-commits
mailing list