[clang] [clang][dataflow] fix assert in `Environment::getResultObjectLocation` (PR #79608)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 29 03:55:52 PST 2024


================
@@ -536,6 +536,11 @@ class TransferVisitor : public ConstStmtVisitor<TransferVisitor> {
 
       copyRecord(*LocSrc, *LocDst, Env);
       Env.setStorageLocation(*S, *LocDst);
+    } else {
+      // CXXOperatorCallExpr can be prvalues, in which case we must create a
+      // record for them in order for `Environment::getResultObjectLocation()`
+      // to be able to return a value.
+      VisitCallExpr(S);
     }
----------------
martinboehme wrote:

```suggestion
      return;
    }

    // CXXOperatorCallExpr can be prvalues. Call `VisitCallExpr`() to create
    // a `RecordValue` for them so that `Environment::getResultObjectLocation()`
    // can return a value.
    VisitCallExpr(S);
```

*  Reduces indentation and makes the default case stand out better
*  Some wordsmithing on the comment

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


More information about the cfe-commits mailing list