From 312a19c781da1c31ff1e3dc71c319663a8be9148 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Thu, 22 Oct 2026 13:56:44 +0000 Subject: feat(codegen): accept pointer types to any C type in EXTERN A pseudocode pointer type now counts as a C type, in EXTERN signatures and as a C-struct field, when it finally points to a non-void C type or a C struct, as in TYPE PInt = ^C_INT. A pointer cycle such as TYPE P = ^P and a pointer to a pseudocode type stay rejected. Co-Authored-By: Claude Opus 5.5 --- lib/CodeGen/CallGen.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib/CodeGen/CallGen.cc') diff --git a/lib/CodeGen/CallGen.cc b/lib/CodeGen/CallGen.cc index a5567b7..576520d 100644 --- a/lib/CodeGen/CallGen.cc +++ b/lib/CodeGen/CallGen.cc @@ -134,8 +134,7 @@ bool CodeGen::marshalCallArgs(const FuncSig &Signature, Value *CodeGen::emitVariadicArgument(ExprAST *Expr, const std::string &Callee, size_t Position, const TypeInfo *&Promoted) { const TypeInfo *Info = isWholeArrayVar(Expr) ? nullptr : getExprTypeInfo(Expr); - const TypeInfo *Record = Info && Info->Kind == TypeKind::Pointer - ? Types->resolve(Info->Pointer.PointeeTypeName) : Info; + const TypeInfo *Record = Types->pointerBase(Info); std::string Why; if (Record && Record->isRecord() && !Record->IsClass && !Types->isCStruct(Record, &Why)) { reportError("Variadic argument %zu to %s uses record %s, which is not a C struct: %s", -- cgit v1.3.1-4-g156e