authorgravatar for jacoblevgw@gmail.comJacob G-W <jacoblevgw@gmail.com> 2020-11-26 18:36:50-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-11-26 16:40:57-08:00
logdaf6c0da5b2d96530dea2d2a907f2b2ba55c8ba6
treebf2effe1d24f8780d5642130903d20c469a0840a
parent21c488ce68480d5298fc51f80f2c854d4ec8c364

CONTRIBUTING: src-self-hosted -> src


1 files changed, 5 insertions(+), 5 deletions(-)

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