llvm_tools.cpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. #include "toolchain/base/llvm_tools.h"
  5. #include "common/command_line.h"
  6. // NOLINTBEGIN(readability-identifier-naming): External library name.
  7. #define CARBON_LLVM_MAIN_TOOL(Identifier, Name, BinName, MainFn) \
  8. extern auto MainFn(int argc, char** argv, const llvm::ToolContext& context) \
  9. -> int;
  10. #include "toolchain/base/llvm_tools.def"
  11. // NOLINTEND(readability-identifier-naming): External library name.
  12. namespace Carbon {
  13. CARBON_DEFINE_ENUM_CLASS_NAMES(LLVMTool) = {
  14. #define CARBON_LLVM_TOOL(Identifier, Name, BinName, MainFn) Name,
  15. #include "toolchain/base/llvm_tools.def"
  16. };
  17. constexpr llvm::StringLiteral LLVMTool::BinNames[] = {
  18. #define CARBON_LLVM_TOOL(Identifier, Name, BinName, MainFn) BinName,
  19. #include "toolchain/base/llvm_tools.def"
  20. };
  21. constexpr LLVMTool::MainFnT* LLVMTool::MainFns[] = {
  22. #define CARBON_LLVM_TOOL(Identifier, Name, BinName, MainFn) &::MainFn,
  23. #include "toolchain/base/llvm_tools.def"
  24. };
  25. constexpr CommandLine::CommandInfo LLVMTool::SubcommandInfos[] = {
  26. #define CARBON_LLVM_TOOL(Identifier, Name, BinName, MainFn) \
  27. {.name = Name, \
  28. .help = "Runs the LLVM " Name \
  29. " command line tool with the provided arguments."},
  30. #include "toolchain/base/llvm_tools.def"
  31. };
  32. } // namespace Carbon