From 5eccd90b47b327917ad0e5858c79ca8fab27cd74 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Thu, 22 Oct 2026 13:51:44 +0000 Subject: feat(codegen): pass C-struct records by value as variadic arguments A variadic EXTERN call is now arranged by clang per call, from the fixed parameter count and the promoted argument types. C-struct records pass unchanged in variadic positions, as C11 6.5.2.2p6-7 and 7.16.1.1p2 allow; a record that is not a C struct names the offending field. Co-Authored-By: Claude Opus 5.5 --- lib/CodeGen/ExpressionGen.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/CodeGen/ExpressionGen.cc') diff --git a/lib/CodeGen/ExpressionGen.cc b/lib/CodeGen/ExpressionGen.cc index ece055a..d7a4ba7 100644 --- a/lib/CodeGen/ExpressionGen.cc +++ b/lib/CodeGen/ExpressionGen.cc @@ -231,9 +231,10 @@ Value *CodeGen::emitCall(const std::string &Callee, } std::vector Args; + std::vector Variadic; const FuncSig *Sig = resolveCall(Name, ArgExprs, Explicit); - if (!Sig || !marshalCallArgs(*Sig, ArgExprs, Line, Args)) return nullptr; - return FuncGen->emitCall(*Sig, Args); + if (!Sig || !marshalCallArgs(*Sig, ArgExprs, Line, Args, &Variadic)) return nullptr; + return FuncGen->emitCall(*Sig, Args, Variadic); } Value *CodeGen::emitAllocationSize(ExprAST *Expr) { -- cgit v1.3.1-4-g156e