[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)

via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 12 17:35:20 PDT 2023


================
@@ -827,6 +829,9 @@ bool ByteCodeExprGen<Emitter>::VisitArrayInitLoopExpr(
 
 template <class Emitter>
 bool ByteCodeExprGen<Emitter>::VisitOpaqueValueExpr(const OpaqueValueExpr *E) {
+  if (OpaqueExprs.contains(E))
+    return this->emitGetLocal(*classify(E), OpaqueExprs[E], E);
----------------
isuckatcs wrote:

Good question, I found this in the test files:

```
`-OpaqueValueExpr {{.*}} 'result_t':'awaitable_frame::result_t' lvalue
   `-MaterializeTemporaryExpr {{.*}} 'result_t':'awaitable_frame::result_t' lvalue
      `-...
```
```
struct awaitable_frame {
  ...
  struct result_t {
    ~result_t();
    bool await_ready() const noexcept;
    void await_suspend(std::coroutine_handle<void>) noexcept;
    void await_resume() const noexcept;
  };
  ...
};
```
Based on this it seems like it can be a composite type, so I'll make sure this case is handled too.

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


More information about the cfe-commits mailing list