[clang] [CIR] Upstream basic support for sizeof and alignof (PR #130847)
Amr Hesham via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 12 14:17:12 PDT 2025
================
@@ -148,3 +150,27 @@ mlir::Value ScalarExprEmitter::VisitCastExpr(CastExpr *ce) {
}
return {};
}
+
+/// Return the size or alignment of the type of argument of the sizeof
+/// expression as an integer.
+mlir::Value ScalarExprEmitter::VisitUnaryExprOrTypeTraitExpr(
+ const UnaryExprOrTypeTraitExpr *e) {
+ const QualType typeToSize = e->getTypeOfArgument();
+ if (e->getKind() == UETT_SizeOf) {
+ if (const VariableArrayType *variableArrTy =
+ cgf.getContext().getAsVariableArrayType(typeToSize)) {
+ cgf.getCIRGenModule().errorNYI(e->getSourceRange(),
----------------
AmrDeveloper wrote:
Nice i used 1 as recovering value for unimplemented yet cases
https://github.com/llvm/llvm-project/pull/130847
More information about the cfe-commits
mailing list