-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
backend-cThe C backend (CBE) outputs C source code.The C backend (CBE) outputs C source code.contributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.This issue is limited in scope and/or knowledge of Zig internals.enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.frontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.
Milestone
Description
There are two functions where we lower Zig types to C types:
Lines 727 to 733 in 83a4bb6
| fn renderTypeAndName( | |
| dg: *DeclGen, | |
| w: anytype, | |
| ty: Type, | |
| name: CValue, | |
| mutability: Mutability, | |
| ) error{ OutOfMemory, AnalysisFail }!void { |
Line 471 in 83a4bb6
| fn renderType(dg: *DeclGen, w: anytype, t: Type) error{ OutOfMemory, AnalysisFail }!void { |
Right now it is hacky and not correct for more complex types. It needs to be improved to fully support C types, particularly regarding function pointers.
Thankfully, @Vexu already solved this problem in arocc so we can borrow from this project:
Part of this issue is coming up with complex Zig types as test cases and making sure they properly lower to C types.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
backend-cThe C backend (CBE) outputs C source code.The C backend (CBE) outputs C source code.contributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.This issue is limited in scope and/or knowledge of Zig internals.enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.frontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.