CONTRIBUTING: src-self-hosted -> src

master
g-w1 2020-11-26 18:36:50 -05:00 committed by Andrew Kelley
parent 21c488ce68
commit daf6c0da5b
1 changed files with 5 additions and 5 deletions

View File

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