[clang] [LifetimeSafety] Suppress annotation inference for owner-capturing constructors (PR #223635)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 15 05:03:05 PDT 2026


================
@@ -387,6 +387,11 @@ bool isGslOwnerType(const CXXRecordDecl *RD) {
   return isRecordWithAttr<OwnerAttr>(RD);
 }
 
+bool isOwnerPtrCtor(const CXXConstructorDecl *Ctor, const ParmVarDecl *PVD) {
+  return Ctor && PVD->getType()->isPointerType() &&
----------------
usx95 wrote:

I suspect it must be very rare in practice. My intuition is that the concept of "owned pointers" is fairly common but "owning views" is somewhat contradictory which are required for such ownership transfer.

But I am happy to accommodate them for uniformity if you insist.

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


More information about the cfe-commits mailing list