| ... | ... | @@ -152,7 +152,7 @@ The relevant tests for this feature are: |
| 152 | 152 | same, and that the program exits cleanly. This kind of test coverage is preferred, when |
| 153 | 153 | possible, because it makes sure that the resulting Zig code is actually viable. |
| 154 | 154 | |
| 155 | | * `test/stage1/behavior/translate_c_macros.zig` - each test case consists of a Zig test |
| 155 | * `test/stage1/behavior/translate_c_macros.zig` - each test case consists of a Zig test |
| 156 | 156 | which checks that the relevant macros in `test/stage1/behavior/translate_c_macros.h`. |
| 157 | 157 | have the correct values. Macros have to be tested separately since they are expanded by |
| 158 | 158 | Clang in `run_translated_c` tests. |
| ... | ... | @@ -173,21 +173,21 @@ repo, we maintain a C API on top of Clang's C++ API: |
| 173 | 173 | Clang's C++ API changes. This one file necessarily does include Clang's C++ headers, which |
| 174 | 174 | makes it the slowest-to-compile source file in all of Zig's codebase. |
| 175 | 175 | |
| 176 | | * `src-self-hosted/clang.zig` - the Zig equivalent of `src/zig_clang.h`. This is a manually |
| 176 | * `src/clang.zig` - the Zig equivalent of `src/zig_clang.h`. This is a manually |
| 177 | 177 | maintained list of types and functions that are ABI-compatible with the Clang C API we |
| 178 | 178 | maintain. In theory this could be generated by running translate-c on `src/zig_clang.h`, |
| 179 | 179 | but that would introduce a dependency cycle, since we are using this file to implement |
| 180 | 180 | translate-c. |
| 181 | 181 | |
| 182 | 182 | Finally, the actual source code for the translate-c feature is |
| 183 | | `src-self-hosted/translate_c.zig`. This code uses the Clang C API exposed by |
| 184 | | `src-self-hosted/clang.zig`, and produces Zig AST. |
| 183 | `src/translate_c.zig`. This code uses the Clang C API exposed by |
| 184 | `src/clang.zig`, and produces Zig AST. |
| 185 | 185 | |
| 186 | 186 | The steps for contributing to translate-c look like this: |
| 187 | 187 | |
| 188 | 188 | 1. Identify a test case you want to improve. Add it as a run-translated-c test |
| 189 | 189 | case (usually preferable), or as a translate-c test case. |
| 190 | 190 | |
| 191 | | 2. Edit `src-self-hosted/translate_c.zig` to improve the behavior. |
| 191 | 2. Edit `src/translate_c.zig` to improve the behavior. |
| 192 | 192 | |
| 193 | 193 | 3. Run the relevant tests: `./zig build test-run-translated-c test-translate-c` |