diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-22 13:56:44 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-22 13:56:44 +0000 |
| commit | 312a19c781da1c31ff1e3dc71c319663a8be9148 (patch) | |
| tree | 80d63213c0d11b1fcf3d67ef6e51289fe4b5096e /lib/CodeGen/FunctionGen.cc | |
| parent | 5eccd90b47b327917ad0e5858c79ca8fab27cd74 (diff) | |
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 <noreply@anthropic.com>
Diffstat (limited to 'lib/CodeGen/FunctionGen.cc')
| -rw-r--r-- | lib/CodeGen/FunctionGen.cc | 3 |
1 files changed, 1 insertions, 2 deletions
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)) { |
