main.cpp 923 B

123456789101112131415161718192021222324
  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 "clang/Tooling/CommonOptionsParser.h"
  5. #include "clang/Tooling/Refactoring.h"
  6. #include "migrate_cpp/cpp_refactoring/fn_inserter.h"
  7. namespace cam = ::clang::ast_matchers;
  8. namespace ct = ::clang::tooling;
  9. auto main(int argc, const char** argv) -> int {
  10. llvm::cl::OptionCategory category("C++ refactoring options");
  11. auto parser = ct::CommonOptionsParser::create(argc, argv, category);
  12. ct::RefactoringTool tool(parser->getCompilations(),
  13. parser->getSourcePathList());
  14. // Set up AST matcher callbacks.
  15. cam::MatchFinder finder;
  16. Carbon::FnInserter fn_inserter(tool.getReplacements(), &finder);
  17. return tool.runAndSave(
  18. clang::tooling::newFrontendActionFactory(&finder).get());
  19. }