clang_subcommand.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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_CLANG_SUBCOMMAND_H_
  5. #define CARBON_TOOLCHAIN_DRIVER_CLANG_SUBCOMMAND_H_
  6. #include "common/command_line.h"
  7. #include "llvm/ADT/SmallVector.h"
  8. #include "llvm/ADT/StringRef.h"
  9. #include "toolchain/driver/driver_env.h"
  10. #include "toolchain/driver/driver_subcommand.h"
  11. namespace Carbon {
  12. // Options for the clang subcommand, which is just a thin wrapper.
  13. //
  14. // See the implementation of `Build` for documentation on members.
  15. struct ClangOptions {
  16. auto Build(CommandLine::CommandBuilder& b) -> void;
  17. bool build_runtimes_on_demand = false;
  18. llvm::SmallVector<llvm::StringRef> args;
  19. };
  20. // Implements the clang subcommand of the driver.
  21. class ClangSubcommand : public DriverSubcommand {
  22. public:
  23. explicit ClangSubcommand();
  24. auto BuildOptions(CommandLine::CommandBuilder& b) -> void override {
  25. options_.Build(b);
  26. }
  27. auto Run(DriverEnv& driver_env) -> DriverResult override;
  28. private:
  29. ClangOptions options_;
  30. };
  31. } // namespace Carbon
  32. #endif // CARBON_TOOLCHAIN_DRIVER_CLANG_SUBCOMMAND_H_