Skip to content

Commit

Permalink
auto merge of #8077 : graydon/rust/reorganize-driver, r=pcwalton
Browse files Browse the repository at this point in the history
The purpose here is to get rid of compile_upto, which pretty much always requires the user to read the source to figure out what it does. It's replaced by a sequence of obviously-named functions:

  - phase_1_parse_input(sess, cfg, input);
  - phase_2_configure_and_expand(sess, cfg, crate);
  - phase_3_run_analysis_passes(sess, expanded_crate);
  - phase_4_translate_to_llvm(sess, expanded_crate, &analysis, outputs);
  - phase_5_run_llvm_passes(sess, &trans, outputs);
  - phase_6_link_output(sess, &trans, outputs); 

Each of which takes what it takes and returns what it returns, with as little variation as possible in behaviour: no "pairs of options" and "pairs of control flags". You can tell if you missed a phase because you will be missing a `phase_N` call to some `N` between 1 and 6.

It does mean that people invoking librustc from outside need to write more function calls. The benefit is that they can _figure out what they're doing_ much more easily, and stop at any point, rather than further overloading the tangled logic of `compile_upto`.
  • Loading branch information
bors committed Jul 27, 2013
2 parents 32622ce + 413446c commit 0981068
Show file tree
Hide file tree
Showing 5 changed files with 292 additions and 279 deletions.

0 comments on commit 0981068

Please sign in to comment.