immunant / c2rust

Migrate C code to Rust
https://c2rust.com/
Other
3.79k stars 219 forks source link

`c2rust-analyze`: Add a `cargo` wrapper #1036

Closed kkysen closed 8 months ago

kkysen commented 8 months ago

This adds an MVP of a cargo wrapper for c2rust-analyze so that it can be run on a whole crate like cargo. This copies the approach from c2rust-instrument, with some minor adjustments:

This allows us to keep using the rustc wrapper in tests, as the tests are all set up as single files meant to be compiled with rustc directly. We can change this, but that'll come later. The exception is the lighttpd_minimal and with_pdg_file tests, as those run on full crates. I converted lighttpd_minimal to use the cargo wrapper as a proof of concept to show it works. I tried to do the same for with_pdg_file, but it updated some of the hashes or something so now the PDG binary has out-of-date DefPathHashes, and I'm not sure how to regenerate a new one.

kkysen commented 8 months ago

@fw-immunant, how'd you generate the reference_pdg.bc? I'd like to regenerate it so it uses up-to-date DefPathHashes, as I think dependency hashes got updated from the ones hardcoded in the test.