================
@@ -567,9 +565,47 @@ class FactGenerator : public 
ConstStmtVisitor<FactGenerator> {
     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:

(We are no more using an RAV to visit bottom-up but using 
`AC.getCFGBuildOptions().setAllAlwaysAdd();` to get a linearised AST stmts CFG 
essentially achieving the bottom up traversal order).

I am not a big fan either of the current top-down approach.
RAV only has a Traverse* which can be used as _before_ but not _after_. Also 
using RAV does not guarantee that CFG does not show the DRE earlier than 
required.

What we can instead do is generate UseFacts separately in another pass on AST 
(not on CFG, we don't need the CFG for this as we are only interested in all 
DRE expressions) which can be context aware.

https://github.com/llvm/llvm-project/pull/154316
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to