compile_subcommand.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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_COMPILE_SUBCOMMAND_H_
  5. #define CARBON_TOOLCHAIN_DRIVER_COMPILE_SUBCOMMAND_H_
  6. #include "common/command_line.h"
  7. #include "common/ostream.h"
  8. #include "llvm/ADT/SmallVector.h"
  9. #include "llvm/ADT/StringRef.h"
  10. #include "toolchain/driver/codegen_options.h"
  11. namespace Carbon {
  12. // Options for the compile subcommand.
  13. //
  14. // See the implementation of `Build` for documentation on members.
  15. struct CompileOptions {
  16. static const CommandLine::CommandInfo Info;
  17. enum class Phase : int8_t {
  18. Lex,
  19. Parse,
  20. Check,
  21. Lower,
  22. CodeGen,
  23. };
  24. friend auto operator<<(llvm::raw_ostream& out, Phase phase)
  25. -> llvm::raw_ostream&;
  26. auto Build(CommandLine::CommandBuilder& b, CodegenOptions& codegen_options)
  27. -> void;
  28. Phase phase;
  29. llvm::StringRef output_filename;
  30. llvm::SmallVector<llvm::StringRef> input_filenames;
  31. bool asm_output = false;
  32. bool force_obj_output = false;
  33. bool dump_shared_values = false;
  34. bool dump_tokens = false;
  35. bool dump_parse_tree = false;
  36. bool dump_raw_sem_ir = false;
  37. bool dump_sem_ir = false;
  38. bool dump_llvm_ir = false;
  39. bool dump_asm = false;
  40. bool dump_mem_usage = false;
  41. bool stream_errors = false;
  42. bool preorder_parse_tree = false;
  43. bool builtin_sem_ir = false;
  44. bool prelude_import = false;
  45. bool include_debug_info = true;
  46. llvm::StringRef exclude_dump_file_prefix;
  47. };
  48. } // namespace Carbon
  49. #endif // CARBON_TOOLCHAIN_DRIVER_COMPILE_SUBCOMMAND_H_