================
@@ -460,25 +460,35 @@ class TransferVisitor : public 
ConstStmtVisitor<TransferVisitor> {
     // So make sure we have a value if we didn't propagate one above.
     if (S->isPRValue() && S->getType()->isRecordType()) {
       if (Env.getValue(*S) == nullptr) {
-        Value *Val = Env.createValue(S->getType());
-        // We're guaranteed to always be able to create a value for record
-        // types.
-        assert(Val != nullptr);
-        Env.setValue(*S, *Val);
+        auto &Loc = Env.getResultObjectLocation(*S);
+        Env.initializeFieldsWithValues(Loc);
+        refreshRecordValue(Loc, Env);
       }
     }
   }
 
   void VisitCXXDefaultInitExpr(const CXXDefaultInitExpr *S) {
     const Expr *InitExpr = S->getExpr();
     assert(InitExpr != nullptr);
-    propagateValueOrStorageLocation(*InitExpr, *S, Env);
+    if (!(S->getType()->isRecordType() && S->isPRValue()))
----------------
martinboehme wrote:

Done. While I'm here, converted this to an early-out (which then also aligns 
better with the comment).

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

Reply via email to