clang_subcommand.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. llvm::SmallVector<llvm::StringRef> args;
  18. };
  19. // Implements the clang subcommand of the driver.
  20. class ClangSubcommand : public DriverSubcommand {
  21. public:
  22. explicit ClangSubcommand();
  23. auto BuildOptions(CommandLine::CommandBuilder& b) -> void override {
  24. options_.Build(b);
  25. }
  26. auto Run(DriverEnv& driver_env) -> DriverResult override;
  27. private:
  28. ClangOptions options_;
  29. };
  30. } // namespace Carbon
  31. #endif // CARBON_TOOLCHAIN_DRIVER_CLANG_SUBCOMMAND_H_