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/FunctionGen.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib/CodeGen/FunctionGen.cc') diff --git a/lib/CodeGen/FunctionGen.cc b/lib/CodeGen/FunctionGen.cc index 6895945..48c9978 100644 --- a/lib/CodeGen/FunctionGen.cc +++ b/lib/CodeGen/FunctionGen.cc @@ -294,8 +294,7 @@ bool FunctionGen::emitExternPrototype(PrototypeAST *Proto) { // Records cross the C boundary only as C structs, by value or through a // pointer type. What names the parameter or return type in diagnostics. auto CheckRecord = [&](const TypeInfo *Info, const std::string &What) { - const TypeInfo *Record = Info->Kind == TypeKind::Pointer - ? Types.resolve(Info->Pointer.PointeeTypeName) : Info; + const TypeInfo *Record = Types.pointerBase(Info); if (!Record || !Record->isRecord() || Record->IsClass) return true; std::string Why; if (!Types.isCStruct(Record, &Why)) { -- cgit v1.3.1-4-g156e