[clang] [LifetimeSafety] Warn on inapplicable `[[clang::lifetimebound]]` when return type can not carry a lifetime (PR #203767)

via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 28 02:51:37 PDT 2026


NeKon69 wrote:

I might have misunderstood some of the feedback, so let me know if I got anything wrong. What I changed:
- I now skip reporting that `lifetimebound` can't be applied to constructor parameters due to the return type not being able to carry origins completely.
- I now call `hasOrigins()` normally for return types.
I haven't added the stricter warning for auditing yet, since I couldn't decide on the design. Should it be a new diagnostic, or just a parameter that enables stricter warnings (e.g. the same we do for tu analysis)?

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


More information about the cfe-commits mailing list