================
@@ -2344,25 +2344,29 @@ mlir::Value
ScalarExprEmitter::VisitUnaryExprOrTypeTraitExpr(
} else {
// C99 6.5.3.4p2: If the argument is an expression of type
// VLA, it is evaluated.
- cgf.getCIRGenModule().errorNYI(
- e->getSourceRange(),
- "sizeof operator for VariableArrayType & evaluateExtent "
- "ignoredExpr",
- e->getStmtClassName());
- return {};
+ cgf.emitIgnoredExpr(e->getArgumentExpr());
}
// For _Countof, we just want to return the size of a single dimension.
if (kind == UETT_CountOf)
return cgf.getVLAElements1D(vat).numElts;
- cgf.getCIRGenModule().errorNYI(
- e->getSourceRange(),
- "sizeof operator for VariableArrayType & evaluateExtent",
- e->getStmtClassName());
- return builder.getConstant(
- loc, cir::IntAttr::get(cgf.cgm.uInt64Ty,
- -llvm::APSInt(llvm::APInt(64, 1), true)));
+ // For sizeof and __datasizeof, we need to scale the number of elements
+ // by the size of the array element type.
+ auto vlaSize = cgf.getVLASize(vat);
----------------
AmrDeveloper wrote:
> I'd say it's somewhat useful. The fact that it's named Pair but doesn't have
> .first and .second members makes it less helpful than it might otherwise be.
> However, having the explicit type here would let me use the "go to
> definition" command in my editor.
That makes sense, I will update it
https://github.com/llvm/llvm-project/pull/169993
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits