mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-25 18:20:09 +01:00
This refactors the main.cpp out into a file structure that should make it easier to add more matchers/tests.
24 lines
867 B
C++
24 lines
867 B
C++
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
// Exceptions. See /LICENSE for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
#include "clang/Tooling/CommonOptionsParser.h"
|
|
#include "clang/Tooling/Refactoring.h"
|
|
#include "migrate_cpp/cpp_refactoring/fn_inserter.h"
|
|
|
|
namespace cam = ::clang::ast_matchers;
|
|
namespace ct = ::clang::tooling;
|
|
|
|
auto main(int argc, const char** argv) -> int {
|
|
llvm::cl::OptionCategory category("C++ refactoring options");
|
|
ct::CommonOptionsParser op(argc, argv, category);
|
|
ct::RefactoringTool tool(op.getCompilations(), op.getSourcePathList());
|
|
|
|
// Set up AST matcher callbacks.
|
|
cam::MatchFinder finder;
|
|
Carbon::FnInserter fn_inserter(tool.getReplacements(), &finder);
|
|
|
|
return tool.runAndSave(
|
|
clang::tooling::newFrontendActionFactory(&finder).get());
|
|
}
|