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 --- include/cps/FunctionGen.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include/cps/FunctionGen.h') diff --git a/include/cps/FunctionGen.h b/include/cps/FunctionGen.h index 8b63d67..6c5c7c0 100644 --- a/include/cps/FunctionGen.h +++ b/include/cps/FunctionGen.h @@ -122,7 +122,9 @@ public: llvm::Function *emitFunctionDef(FunctionDefAST *FuncAST, const std::function &StmtEmitter, unsigned ScopeID); - llvm::Value *emitCall(const FuncSig &Sig, const std::vector &Args); + // Variadic holds the promoted types of an EXTERN call's variadic arguments. + llvm::Value *emitCall(const FuncSig &Sig, const std::vector &Args, + const std::vector &Variadic = {}); void emitReturn(llvm::Value *RetVal); }; -- cgit v1.3.1-4-g156e