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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 28 05:32:38 PDT 2022


aaron.ballman added inline comments.


================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:641
     return this->visitInitializer(DIE->getExpr());
+  } else if (const auto AILE = dyn_cast<ArrayInitLoopExpr>(Initializer)) {
+    // TODO: This compiles to quite a lot of bytecode if the array is larger.
----------------



================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:654-664
+      if (!this->emitDupPtr(SubExpr))
+        return false;
+
+      if (!this->visit(SubExpr))
+        return false;
+
+      if (!this->emitInitElem(*ElemT, I, Initializer))
----------------
In all of these cases we're leaving `ArrayIndex` set to `I` instead of `None`, is that intentional? (Might be worth an RAII object to handle this sort of thing.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134361



More information about the cfe-commits mailing list