aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-22 13:30:00 +0000
committer_ov4 <ov4@ov4.org>2026-10-22 13:30:00 +0000
commit90bf56f456e22dcd98458eca14e0b152a5efb179 (patch)
tree629f46a15ea13d1d71998355f00d77d5c80052a3 /lib/CodeGen
parent4a70e44f06e637762eec0fd875eb94b84c3f4037 (diff)
feat(codegen): accept record pointers as variadic arguments
Pointer types to C-struct records now pass unchanged as variadic EXTERN arguments. Pseudocode values still need a cast to a C type, and records by value stay rejected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/CallGen.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/CodeGen/CallGen.cc b/lib/CodeGen/CallGen.cc
index dfe89d6..b25ca12 100644
--- a/lib/CodeGen/CallGen.cc
+++ b/lib/CodeGen/CallGen.cc
@@ -128,7 +128,8 @@ bool CodeGen::marshalCallArgs(const FuncSig &Signature,
// C values are accepted, matching the explicit-cast rule for C/pseudocode.
Value *CodeGen::emitVariadicArgument(ExprAST *Expr, const std::string &Callee, size_t Position) {
const TypeInfo *Info = isWholeArrayVar(Expr) ? nullptr : getExprTypeInfo(Expr);
- if (!Info || !Info->isC() || Info->isVoid()) {
+ // Pointers to C structs pass unchanged; records by value are not supported yet.
+ if (!Info || Info->isRecord() || !Types->isExternType(Info)) {
reportError("Variadic argument %zu to %s must be a C value; cast it to a C type", Position, Callee.c_str());
return nullptr;
}