precompile and cache Carbon prelude (#7432)

Refactors the link driver to automatically compile and cache the carbon
prelude for use in linking.

Implements a `carbon_library` rule for compiling the Core library
dependencies in the examples.
This commit is contained in:
Lucile Rose Nihlen
2026-07-16 18:02:14 +00:00
committed by GitHub
parent 90f6654b48
commit 625f2ca629
63 changed files with 1454 additions and 634 deletions
+5 -3
View File
@@ -15,8 +15,8 @@
namespace Carbon {
auto BuildSubcommandOptions::Build(CommandLine::CommandBuilder& b) -> void {
compile_options.BuildForBuildSubcommand(b);
link_options.BuildForBuildSubcommand(b);
compile_options.BuildForBuildSubcommand(b, &codegen_options);
link_options.BuildForBuildSubcommand(b, &codegen_options);
b.AddFlag(
{
@@ -50,6 +50,8 @@ auto BuildSubcommand::BuildOptions(CommandLine::CommandBuilder& b) -> void {
}
auto BuildSubcommand::Run(DriverEnv& driver_env) -> DriverResult {
options_.compile_options.FixupFlags();
if (driver_env.fuzzing && !options_.compile_options.clang_args.empty()) {
// Parsing specific Clang arguments can reach deep into
// external libraries that aren't fuzz clean.
@@ -72,7 +74,7 @@ auto BuildSubcommand::Run(DriverEnv& driver_env) -> DriverResult {
}
}
auto on_exit = llvm::scope_exit([&]() {
auto on_exit = llvm::scope_exit([&] {
// Clean up the temporary directory created for compile results.
if (temp_dir) {
auto remove_result = std::move(*temp_dir).Remove();