mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 19:50:14 +01:00
Move `--output-last-file-only` and output filename synthesis logic out of the general-purpose compile driver and into the `carbon compile` subcommand, which is the only thing that should be using them. Track on CompilationUnit whether it is being lowered, or whether it exists only to be imported into other units. `carbon compile` now never lowers inputs that it discovered for itself, only inputs that were specified on the command line. In particular, it doesn't lower (and throw away the result of lowering) the prelude any more. This makes the toolchain tests about 10% faster in my crude measurements. Also, we now do not create a clang `CodeGenerator` for input files that we are not lowering, similarly saving compilation time for units that exist only to be imported, not lowered. One minor change: we use the same mechanism to determine whether an input is being lowered and to determine what the output filename is. This means that `--phase=lower` and `--phase=optimize`, which lower but don't produce an output file, still need an output filename to be specified now in some cases. Given those are just debugging tools, I think that's fine. Assisted-by: Gemini via Antigravity