From 4a70e44f06e637762eec0fd875eb94b84c3f4037 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Thu, 22 Oct 2026 13:27:15 +0000 Subject: feat(codegen): accept pointers to C-struct records in EXTERN signatures A TYPE record whose fields are all C types, C structs or pointer types to C structs now crosses the EXTERN "C" boundary through a pointer type. Records by value are rejected for now, and a pointer to a record with a non-C field names that field. Co-Authored-By: Claude Opus 5.5 --- include/cps/TypeSystem.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include') diff --git a/include/cps/TypeSystem.h b/include/cps/TypeSystem.h index 5f9af63..1c1e422 100644 --- a/include/cps/TypeSystem.h +++ b/include/cps/TypeSystem.h @@ -154,6 +154,13 @@ public: std::string &Err); bool sameType(const std::string &Left, const std::string &Right) const; const TypeInfo *promoteCScalar(const TypeInfo *Info) const; + // A TYPE record (not a CLASS) whose fields are C scalars, C pointers, + // C structs or pointer types to C structs. Otherwise Why, if given, + // names the first offending field and its type. + bool isCStruct(const TypeInfo *Info, std::string *Why = nullptr) const; + // Crosses the EXTERN "C" boundary: a non-void C type, a C struct or a + // pointer type to one. + bool isExternType(const TypeInfo *Info) const; const TypeInfo *commonCScalar(const TypeInfo *Left, const TypeInfo *Right) const; const EnumConstant *lookupEnumConstant(const std::string &Name) const; -- cgit v1.3.1-4-g156e