mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 22:02:23 +01:00
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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user