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

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 13 14:17:21 PDT 2022


shafik added inline comments.


================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:737
+    auto ArrayType = IVIE->getType()->getAsArrayTypeUnsafe();
+    const auto *CAT = dyn_cast<ConstantArrayType>(ArrayType);
+    const size_t NumElems = CAT->getSize().getZExtValue();
----------------
I believe you should check `ArrayType` before you use it.


================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:748
+      } else {
+        assert(false && "default initializer for non-primitive type");
+      }
----------------
I guess this covers both arrays and class types?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135013



More information about the cfe-commits mailing list