[clang] [LifetimeSafety] Propagate loans through pointer arithmetic (PR #189546)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 31 01:46:47 PDT 2026


================
@@ -378,11 +371,22 @@ void FactsGenerator::handleAssignment(const Expr *LHSExpr,
   flow(LHSList->peelOuterOrigin(), RHSList, /*Kill=*/true);
 }
 
+void FactsGenerator::handlePointerArithmetic(const BinaryOperator *BO) {
+  if (Expr *RHS = BO->getRHS(); RHS->getType()->isPointerType()) {
+    flowOrigin(*BO, *RHS);
----------------
Xazax-hun wrote:

I wonder if we actually want to `killAndFlowOrigin` here. 

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


More information about the cfe-commits mailing list