[PATCH] D134361: [clang][Interp] Fix copy constructors of structs with array members

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 28 10:07:36 PDT 2022


tbaeder added inline comments.


================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:649
+
+    if (!ElemT)
+      return false;
----------------
shafik wrote:
> Curious what case requires this check?
I don't think there's a real test case for this, we could as well change the initializer to `*classify(SubExpr->getType());`. It's just the pattern used everywhere else. We could also use `classifyPrim` instead.


================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.h:382
+  ByteCodeExprGen<Emitter> *Ctx;
+  Optional<uint64_t> OldArrayIndex;
+};
----------------
shafik wrote:
> Why an `Optional`? Your not checking it and I don't see how it won't be set?
The first time we see an `ArrayInitLoopExpr`, the `ByteCodeExprGen<Emitter>::ArrayIndex` will be `None`, so we need to use this here (note: just writing this right now, it's pretty late for me, I didn't test //just// using  a `uint64_t`)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134361/new/

https://reviews.llvm.org/D134361



More information about the cfe-commits mailing list