build_runtimes_subcommand.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. #ifndef CARBON_TOOLCHAIN_DRIVER_BUILD_RUNTIMES_SUBCOMMAND_H_
  5. #define CARBON_TOOLCHAIN_DRIVER_BUILD_RUNTIMES_SUBCOMMAND_H_
  6. #include "common/command_line.h"
  7. #include "llvm/ADT/SmallVector.h"
  8. #include "llvm/ADT/StringRef.h"
  9. #include "toolchain/driver/codegen_options.h"
  10. #include "toolchain/driver/driver_env.h"
  11. #include "toolchain/driver/driver_subcommand.h"
  12. namespace Carbon {
  13. // Options for the `build_runtimes` subcommand.
  14. //
  15. // See the implementation of `Build` for documentation on members.
  16. struct BuildRuntimesOptions {
  17. auto Build(CommandLine::CommandBuilder& b) -> void;
  18. CodegenOptions codegen_options;
  19. llvm::StringRef directory;
  20. bool force;
  21. };
  22. // Implements the link subcommand of the driver.
  23. class BuildRuntimesSubcommand : public DriverSubcommand {
  24. public:
  25. explicit BuildRuntimesSubcommand();
  26. auto BuildOptions(CommandLine::CommandBuilder& b) -> void override {
  27. options_.Build(b);
  28. }
  29. auto Run(DriverEnv& driver_env) -> DriverResult override;
  30. private:
  31. auto RunInternal(DriverEnv& driver_env) -> ErrorOr<std::filesystem::path>;
  32. BuildRuntimesOptions options_;
  33. };
  34. } // namespace Carbon
  35. #endif // CARBON_TOOLCHAIN_DRIVER_BUILD_RUNTIMES_SUBCOMMAND_H_