Files
carbon-lang/toolchain/driver/clang_subcommand.h
T
Chandler CarruthandGeoff Romer fd70196c67 Introduce a runtimes caching and management layer (#6002)
This layer allows runtimes to be built on-demand but cached in a
consistent and re-usable location on the system. It handles careful
filesystem operations to ensure consistency even in the face of multiple
versions and build configurations.

This addresses a number of TODOs from the initial runtimes building
on-demand, and sets the stage to scale up to more runtimes.

This doesn't switch on-demand runtimes to be on by default, I wanted to
wait and make that change as a separate step.

---------

Co-authored-by: Geoff Romer <gromer@google.com>
2025-09-25 12:30:50 +00:00

45 lines
1.2 KiB
C++

// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#ifndef CARBON_TOOLCHAIN_DRIVER_CLANG_SUBCOMMAND_H_
#define CARBON_TOOLCHAIN_DRIVER_CLANG_SUBCOMMAND_H_
#include "common/command_line.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "toolchain/driver/driver_env.h"
#include "toolchain/driver/driver_subcommand.h"
namespace Carbon {
// Options for the clang subcommand, which is just a thin wrapper.
//
// See the implementation of `Build` for documentation on members.
struct ClangOptions {
auto Build(CommandLine::CommandBuilder& b) -> void;
bool build_runtimes_on_demand = false;
llvm::SmallVector<llvm::StringRef> args;
};
// Implements the clang subcommand of the driver.
class ClangSubcommand : public DriverSubcommand {
public:
explicit ClangSubcommand();
auto BuildOptions(CommandLine::CommandBuilder& b) -> void override {
options_.Build(b);
}
auto Run(DriverEnv& driver_env) -> DriverResult override;
private:
ClangOptions options_;
};
} // namespace Carbon
#endif // CARBON_TOOLCHAIN_DRIVER_CLANG_SUBCOMMAND_H_