Files
carbon-lang/migrate_cpp/cpp_refactoring/main.cpp
T
Chandler Carruth 4034fa223d Update LLVM (and llvm-bazel). (#550)
This picks up a newer version of LLVM and the LLVM Bazel integration.
The big change here is that we can configure the LLVM targets that are
built, which allows us to dramatically reduce the build costs by
focusing on a couple of CPUs for the time being.

There are a few API updates needed as well.

This also rotates the cache version so we start with a clean Bazel cache
from here. Otherwise we'd potentially pay the cost of carrying around
stale bits of LLVM endlessly.
2021-05-25 15:21:57 -07:00

25 lines
923 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");
auto parser = ct::CommonOptionsParser::create(argc, argv, category);
ct::RefactoringTool tool(parser->getCompilations(),
parser->getSourcePathList());
// Set up AST matcher callbacks.
cam::MatchFinder finder;
Carbon::FnInserter fn_inserter(tool.getReplacements(), &finder);
return tool.runAndSave(
clang::tooling::newFrontendActionFactory(&finder).get());
}