================
@@ -847,7 +845,33 @@ template <class Emitter>
 bool ByteCodeExprGen<Emitter>::VisitOpaqueValueExpr(const OpaqueValueExpr *E) {
   if (Initializing)
     return this->visitInitializer(E->getSourceExpr());
-  return this->visit(E->getSourceExpr());
+
+  PrimType CacheVariableTy = classify(E).value_or(PT_Ptr);
+  if (OpaqueExprs.contains(E))
+    return this->emitGetLocal(CacheVariableTy, OpaqueExprs[E], E);
+
+  if (!this->visit(E->getSourceExpr()))
+    return false;
+
+  // At this point we either have the evaluated source expression or a pointer
+  // to an object on the stack. We want to create a local variable that stores
+  // this value.
+  std::optional<unsigned> LocalIndex =
+      allocateLocalPrimitive(E, CacheVariableTy, true);
----------------
tbaederr wrote:

```suggestion
      allocateLocalPrimitive(E, CacheVariableTy, /*IsConst=*/true);
```

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

Reply via email to