OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // This implements a Clang tool to generate compilation information that is | 5 // This implements a Clang tool to generate compilation information that is |
6 // sufficient to recompile the code with clang. For each compilation unit, all | 6 // sufficient to recompile the code with clang. For each compilation unit, all |
7 // source files which are necessary for compiling it are determined. For each | 7 // source files which are necessary for compiling it are determined. For each |
8 // compilation unit, a file is created containing a list of all file paths of | 8 // compilation unit, a file is created containing a list of all file paths of |
9 // included files. | 9 // included files. |
10 | 10 |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 | 258 |
259 static llvm::cl::extrahelp common_help(CommonOptionsParser::HelpMessage); | 259 static llvm::cl::extrahelp common_help(CommonOptionsParser::HelpMessage); |
260 | 260 |
261 int main(int argc, const char* argv[]) { | 261 int main(int argc, const char* argv[]) { |
262 llvm::cl::OptionCategory category("TranslationUnitGenerator Tool"); | 262 llvm::cl::OptionCategory category("TranslationUnitGenerator Tool"); |
263 CommonOptionsParser options(argc, argv, category); | 263 CommonOptionsParser options(argc, argv, category); |
264 std::unique_ptr<clang::tooling::FrontendActionFactory> frontend_factory = | 264 std::unique_ptr<clang::tooling::FrontendActionFactory> frontend_factory = |
265 clang::tooling::newFrontendActionFactory<CompilationIndexerAction>(); | 265 clang::tooling::newFrontendActionFactory<CompilationIndexerAction>(); |
266 clang::tooling::ClangTool tool(options.getCompilations(), | 266 clang::tooling::ClangTool tool(options.getCompilations(), |
267 options.getSourcePathList()); | 267 options.getSourcePathList()); |
268 // This clang tool does not actually produce edits, but run_tool.py expects | |
269 // this. So we just print an empty edit block. | |
270 llvm::outs() << "==== BEGIN EDITS ====\n"; | |
271 llvm::outs() << "==== END EDITS ====\n"; | |
272 return tool.run(frontend_factory.get()); | 268 return tool.run(frontend_factory.get()); |
273 } | 269 } |
OLD | NEW |