[clang] [LifetimeSafety] Detect use of a reference type as a use of underlying origin (PR #184295)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 3 04:42:01 PST 2026


================
@@ -347,7 +347,8 @@ void FactsGenerator::handleAssignment(const Expr *LHSExpr,
   // assigned.
   RHSList = getRValueOrigins(RHSExpr, RHSList);
 
-  if (const auto *DRE_LHS = dyn_cast<DeclRefExpr>(LHSExpr))
+  if (const auto *DRE_LHS = dyn_cast<DeclRefExpr>(LHSExpr);
----------------
Xazax-hun wrote:

I wonder what should happen when we have multiple levels of origins.

```
  int *& ref = p;
  ref = q;
```

Shouldn't we still consider this a write for the pointer?

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


More information about the cfe-commits mailing list