================ @@ -254,3 +254,27 @@ mlir::Type CIRGenTypes::convertTypeForMem(clang::QualType qualType, return convertedType; } + +bool CIRGenTypes::isZeroInitializable(clang::QualType t) { + if (t->getAs<PointerType>()) + return astContext.getTargetNullPointerValue(t) == 0; + + if (const auto *at = astContext.getAsArrayType(t)) { + if (isa<IncompleteArrayType>(at)) + return true; + + if (const auto *cat = dyn_cast<ConstantArrayType>(at)) + if (astContext.getConstantArrayElementCount(cat) == 0) + return true; + } + + if (const RecordType *rt = t->getAs<RecordType>()) { + cgm.errorNYI(SourceLocation(), "isZeroInitializable for RecordType", t); ---------------- andykaylor wrote:
Should we return false after the NYI case? https://github.com/llvm/llvm-project/pull/132974 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits