[clang] [CIR] Implement __builtin_object_size and __builtin_dynamic_object_size (PR #166191)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 3 10:49:38 PST 2025
================
@@ -641,3 +654,44 @@ mlir::Value CIRGenFunction::emitVAArg(VAArgExpr *ve) {
mlir::Value vaList = emitVAListRef(ve->getSubExpr()).getPointer();
return cir::VAArgOp::create(builder, loc, type, vaList);
}
+
+/// Returns a Value corresponding to the size of the given expression by
+/// emitting a `cir.objsize` operation.
+///
+/// emittedE is the result of emitting `e` as a scalar expr. If it's non-null,
+/// we'll call `cir.objsize` on emittedE, rather than emitting e.
+mlir::Value CIRGenFunction::emitBuiltinObjectSize(const Expr *e, unsigned type,
----------------
andykaylor wrote:
A comment explaining what `type` means would be helpful. In particular, the comments below about "type=3" are rather meaningless without a more general explanation of this parameter.
https://github.com/llvm/llvm-project/pull/166191
More information about the cfe-commits
mailing list