driver_subcommand.h 952 B

123456789101112131415161718192021222324252627282930313233
  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_DRIVER_SUBCOMMAND_H_
  5. #define CARBON_TOOLCHAIN_DRIVER_DRIVER_SUBCOMMAND_H_
  6. #include "common/ostream.h"
  7. #include "llvm/Support/VirtualFileSystem.h"
  8. #include "toolchain/driver/driver_env.h"
  9. #include "toolchain/install/install_paths.h"
  10. namespace Carbon {
  11. // The result of a driver run.
  12. struct DriverResult {
  13. // Overall success result.
  14. bool success;
  15. // Per-file success results. May be empty if files aren't individually
  16. // processed.
  17. llvm::SmallVector<std::pair<std::string, bool>> per_file_success;
  18. };
  19. // A subcommand for the driver.
  20. class DriverSubcommand {
  21. public:
  22. virtual auto Run(DriverEnv& driver_env) -> DriverResult = 0;
  23. };
  24. } // namespace Carbon
  25. #endif // CARBON_TOOLCHAIN_DRIVER_DRIVER_SUBCOMMAND_H_