[clang] [clang] Introduce [[clang::lifetime_capture_by(X)]] (PR #111499)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 7 07:42:14 PST 2024


Xazax-hun wrote:

Hey! 

Thanks for working on this! Some high level comments based on the description:

> 1.  Class inherited from a pointer-like type.

In this false positive example slicing is happening and we know that the created type (after slicing) is a pointer. Do we always get these false positives with slicing? If that is the case, could we just suppress the warning when derived-to-base conversion happens where the base is a pointer?

 > 2. Not able to differentiate between pointer-type and value type with templates
 
I think this is a really serious problem that could hinder usability. I'd prefer to not emit warnings for templates until this one is fixed. Do you think this would make sense or would this suppress all of the interesting cases that you want to catch?

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


More information about the cfe-commits mailing list