| 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 13 matching lines...) Expand all Loading... |
| 24 #include "clang/Frontend/CompilerInstance.h" | 24 #include "clang/Frontend/CompilerInstance.h" |
| 25 #include "clang/Frontend/FrontendActions.h" | 25 #include "clang/Frontend/FrontendActions.h" |
| 26 #include "clang/Lex/HeaderSearchOptions.h" | 26 #include "clang/Lex/HeaderSearchOptions.h" |
| 27 #include "clang/Lex/PPCallbacks.h" | 27 #include "clang/Lex/PPCallbacks.h" |
| 28 #include "clang/Lex/Preprocessor.h" | 28 #include "clang/Lex/Preprocessor.h" |
| 29 #include "clang/Tooling/CommonOptionsParser.h" | 29 #include "clang/Tooling/CommonOptionsParser.h" |
| 30 #include "clang/Tooling/CompilationDatabase.h" | 30 #include "clang/Tooling/CompilationDatabase.h" |
| 31 #include "clang/Tooling/Refactoring.h" | 31 #include "clang/Tooling/Refactoring.h" |
| 32 #include "clang/Tooling/Tooling.h" | 32 #include "clang/Tooling/Tooling.h" |
| 33 #include "llvm/Support/CommandLine.h" | 33 #include "llvm/Support/CommandLine.h" |
| 34 #include "llvm/Support/Path.h" |
| 34 | 35 |
| 35 using clang::HeaderSearchOptions; | 36 using clang::HeaderSearchOptions; |
| 36 using clang::tooling::CommonOptionsParser; | 37 using clang::tooling::CommonOptionsParser; |
| 37 using std::set; | 38 using std::set; |
| 38 using std::stack; | 39 using std::stack; |
| 39 using std::string; | 40 using std::string; |
| 40 using std::vector; | 41 using std::vector; |
| 41 | 42 |
| 42 namespace { | 43 namespace { |
| 43 // Set of preprocessor callbacks used to record files included. | 44 // Set of preprocessor callbacks used to record files included. |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 std::unique_ptr<clang::tooling::FrontendActionFactory> frontend_factory = | 264 std::unique_ptr<clang::tooling::FrontendActionFactory> frontend_factory = |
| 264 clang::tooling::newFrontendActionFactory<CompilationIndexerAction>(); | 265 clang::tooling::newFrontendActionFactory<CompilationIndexerAction>(); |
| 265 clang::tooling::ClangTool tool(options.getCompilations(), | 266 clang::tooling::ClangTool tool(options.getCompilations(), |
| 266 options.getSourcePathList()); | 267 options.getSourcePathList()); |
| 267 // This clang tool does not actually produce edits, but run_tool.py expects | 268 // This clang tool does not actually produce edits, but run_tool.py expects |
| 268 // this. So we just print an empty edit block. | 269 // this. So we just print an empty edit block. |
| 269 llvm::outs() << "==== BEGIN EDITS ====\n"; | 270 llvm::outs() << "==== BEGIN EDITS ====\n"; |
| 270 llvm::outs() << "==== END EDITS ====\n"; | 271 llvm::outs() << "==== END EDITS ====\n"; |
| 271 return tool.run(frontend_factory.get()); | 272 return tool.run(frontend_factory.get()); |
| 272 } | 273 } |
| OLD | NEW |