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

Gábor Horváth via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Sep 2 06:55:29 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()))
----------------
Xazax-hun wrote:

Could we use the expression type directly instead of the type of the decl?

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


More information about the llvm-branch-commits mailing list