[clang] [LifetimeSafety] Implement multi-level origins (PR #168344)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 11 07:31:05 PST 2025


================
@@ -186,8 +284,28 @@ void FactsGenerator::VisitConditionalOperator(const ConditionalOperator *CO) {
 void FactsGenerator::VisitCXXOperatorCallExpr(const CXXOperatorCallExpr *OCE) {
   // Assignment operators have special "kill-then-propagate" semantics
   // and are handled separately.
-  if (OCE->isAssignmentOp() && OCE->getNumArgs() == 2) {
-    handleAssignment(OCE->getArg(0), OCE->getArg(1));
+  if (OCE->getOperator() == OO_Equal && OCE->getNumArgs() == 2) {
+
+    const Expr *LHSExpr = OCE->getArg(0);
+    const Expr *RHSExpr = OCE->getArg(1);
+
+    if (const auto *DRE_LHS =
+            dyn_cast<DeclRefExpr>(LHSExpr->IgnoreParenImpCasts())) {
+      OriginList *LHSList = getOriginsList(*DRE_LHS);
----------------
usx95 wrote:

Good point. I missed this. Added a precheck of hasOrigins.

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


More information about the cfe-commits mailing list