================
@@ -155,20 +155,17 @@ class TransferVisitor : public 
ConstStmtVisitor<TransferVisitor> {
     const Expr *RHS = S->getRHS();
     assert(RHS != nullptr);
 
-    // Do compound assignments up-front, as there are so many of them and we
-    // don't want to list all of them in the switch statement below.
-    // To avoid generating unnecessary values, we don't create a new value but
-    // instead leave it to the specific analysis to do this if desired.
-    if (S->isCompoundAssignmentOp())
-      propagateStorageLocation(*S->getLHS(), *S, Env);
-
-    switch (S->getOpcode()) {
-    case BO_Assign: {
+    // Do assignments and compound assignments up-front, as there are
+    // so many of them and we don't want to list all of them in
+    // the switch statement below.
+    if (S->isAssignmentOp()) {
       auto *LHSLoc = Env.getStorageLocation(*LHS);
       if (LHSLoc == nullptr)
-        break;
+        return;
 
-      auto *RHSVal = Env.getValue(*RHS);
+      // Compound assignments involve arithmetic we don't model yet.
+      Value *RHSVal =
+          S->isCompoundAssignmentOp() ? nullptr : Env.getValue(*RHS);
       if (RHSVal == nullptr)
         RHSVal = Env.createValue(LHS->getType());
----------------
ymand wrote:

Note that `createValue` can still return nullptr, so you have to account for 
that case.

https://github.com/llvm/llvm-project/pull/179058
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to