[llvm-branch-commits] [clang] [LifetimeSafety] Mark all DeclRefExpr as usages of the corresp. origin (PR #154316)

Utkarsh Saxena via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Sep 3 04:13:22 PDT 2025


================
@@ -556,8 +554,47 @@ class FactGeneratorVisitor : public ConstStmtVisitor<FactGeneratorVisitor> {
     return false;
   }
 
+  void handleAssignment(const Expr *LHSExpr, const Expr *RHSExpr) {
+    // Find the underlying variable declaration for the left-hand side.
+    if (const auto *DRE_LHS =
+            dyn_cast<DeclRefExpr>(LHSExpr->IgnoreParenImpCasts())) {
+      markUseAsWrite(DRE_LHS);
+      if (const auto *VD_LHS = dyn_cast<ValueDecl>(DRE_LHS->getDecl()))
----------------
usx95 wrote:

Used `LHSExpr->getType()`.

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


More information about the llvm-branch-commits mailing list