[clang] [llvm] [LifetimeSafety] Add lifetimebound inference for std::make_unique (PR #191632)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 12 09:42:39 PDT 2026


================
@@ -484,7 +484,8 @@ void FactsGenerator::VisitCXXOperatorCallExpr(const CXXOperatorCallExpr *OCE) {
       hasOrigins(OCE->getArg(0)->getType())) {
     // Pointer-like types: assignment inherently propagates origins.
     QualType LHSTy = OCE->getArg(0)->getType();
-    if (LHSTy->isPointerOrReferenceType() || isGslPointerType(LHSTy)) {
+    if (LHSTy->isPointerOrReferenceType() || isGslPointerType(LHSTy) ||
+        isGslOwnerType(LHSTy)) {
----------------
usx95 wrote:

This is primarily to allow loan propagation across assignment and specially opaque user-defined assignment operators.

I feel a bit torn here and feel that origin propagation should happen regardless in all cases (if there is an origin). This becomes more natural if we move towards type-integration and subtyping rules.

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


More information about the cfe-commits mailing list