[PATCH] D135013: [clang][Interp] Array initialization via ImplicitValueInitExpr

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 20 08:22:14 PDT 2022


aaron.ballman added inline comments.


================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:726
+  } else if (const auto *IVIE = dyn_cast<ImplicitValueInitExpr>(Initializer)) {
+    auto ArrayType = IVIE->getType()->getAsArrayTypeUnsafe();
+    assert(ArrayType);
----------------
Please spell out the type.


================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:728
+    assert(ArrayType);
+    const auto *CAT = dyn_cast<ConstantArrayType>(ArrayType);
+    const size_t NumElems = CAT->getSize().getZExtValue();
----------------
Should this be using `cast<>` as the code below is assuming this pointer will never be null?


================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:729
+    const auto *CAT = dyn_cast<ConstantArrayType>(ArrayType);
+    const size_t NumElems = CAT->getSize().getZExtValue();
+
----------------



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

https://reviews.llvm.org/D135013



More information about the cfe-commits mailing list