main.cpp 867 B

1234567891011121314151617181920212223
  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. ct::CommonOptionsParser op(argc, argv, category);
  12. ct::RefactoringTool tool(op.getCompilations(), op.getSourcePathList());
  13. // Set up AST matcher callbacks.
  14. cam::MatchFinder finder;
  15. Carbon::FnInserter fn_inserter(tool.getReplacements(), &finder);
  16. return tool.runAndSave(
  17. clang::tooling::newFrontendActionFactory(&finder).get());
  18. }