| 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 |
| 11 #include <assert.h> | 11 #include <assert.h> |
| 12 #include <unistd.h> | |
| 13 #include <fstream> | 12 #include <fstream> |
| 14 #include <iostream> | 13 #include <iostream> |
| 15 #include <memory> | 14 #include <memory> |
| 16 #include <set> | 15 #include <set> |
| 17 #include <stack> | 16 #include <stack> |
| 18 #include <string> | 17 #include <string> |
| 19 #include <vector> | 18 #include <vector> |
| 20 | 19 |
| 21 #include "clang/Basic/Diagnostic.h" | 20 #include "clang/Basic/Diagnostic.h" |
| 22 #include "clang/Basic/FileManager.h" | 21 #include "clang/Basic/FileManager.h" |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 | 259 |
| 261 int main(int argc, const char* argv[]) { | 260 int main(int argc, const char* argv[]) { |
| 262 llvm::cl::OptionCategory category("TranslationUnitGenerator Tool"); | 261 llvm::cl::OptionCategory category("TranslationUnitGenerator Tool"); |
| 263 CommonOptionsParser options(argc, argv, category); | 262 CommonOptionsParser options(argc, argv, category); |
| 264 std::unique_ptr<clang::tooling::FrontendActionFactory> frontend_factory = | 263 std::unique_ptr<clang::tooling::FrontendActionFactory> frontend_factory = |
| 265 clang::tooling::newFrontendActionFactory<CompilationIndexerAction>(); | 264 clang::tooling::newFrontendActionFactory<CompilationIndexerAction>(); |
| 266 clang::tooling::ClangTool tool(options.getCompilations(), | 265 clang::tooling::ClangTool tool(options.getCompilations(), |
| 267 options.getSourcePathList()); | 266 options.getSourcePathList()); |
| 268 return tool.run(frontend_factory.get()); | 267 return tool.run(frontend_factory.get()); |
| 269 } | 268 } |
| OLD | NEW |