OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 """Wrapper script to help run clang tools across Chromium code. | 5 """Wrapper script to help run clang tools across Chromium code. |
6 | 6 |
7 How to use this tool: | 7 How to use this tool: |
8 If you want to run the tool across all Chromium code: | 8 If you want to run the tool across all Chromium code: |
9 run_tool.py <tool> <path/to/compiledb> | 9 run_tool.py <tool> <path/to/compiledb> |
10 | 10 |
11 If you want to include all files mentioned in the compilation database: | 11 If you want to include all files mentioned in the compilation database: |
12 run_tool.py <tool> <path/to/compiledb> --all | 12 run_tool.py <tool> <path/to/compiledb> --all |
13 | 13 |
14 If you only want to run the tool across just chrome/browser and content/browser: | 14 If you only want to run the tool across just chrome/browser and content/browser: |
15 run_tool.py <tool> <path/to/compiledb> chrome/browser content/browser | 15 run_tool.py <tool> <path/to/compiledb> chrome/browser content/browser |
16 | 16 |
17 Please see https://code.google.com/p/chromium/wiki/ClangToolRefactoring for more | 17 Please see https://chromium.googlesource.com/chromium/src/+/master/docs/clang_to
ol_refactoring.md for more |
18 information, which documents the entire automated refactoring flow in Chromium. | 18 information, which documents the entire automated refactoring flow in Chromium. |
19 | 19 |
20 Why use this tool: | 20 Why use this tool: |
21 The clang tool implementation doesn't take advantage of multiple cores, and if | 21 The clang tool implementation doesn't take advantage of multiple cores, and if |
22 it fails mysteriously in the middle, all the generated replacements will be | 22 it fails mysteriously in the middle, all the generated replacements will be |
23 lost. | 23 lost. |
24 | 24 |
25 Unfortunately, if the work is simply sharded across multiple cores by running | 25 Unfortunately, if the work is simply sharded across multiple cores by running |
26 multiple RefactoringTools, problems arise when they attempt to rewrite a file at | 26 multiple RefactoringTools, problems arise when they attempt to rewrite a file at |
27 the same time. To work around that, clang tools that are run using this tool | 27 the same time. To work around that, clang tools that are run using this tool |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 # useful to modify files that aren't under source control--typically, these | 344 # useful to modify files that aren't under source control--typically, these |
345 # are generated files or files in a git submodule that's not part of Chromium. | 345 # are generated files or files in a git submodule that's not part of Chromium. |
346 _ApplyEdits({k: v | 346 _ApplyEdits({k: v |
347 for k, v in dispatcher.edits.iteritems() | 347 for k, v in dispatcher.edits.iteritems() |
348 if os.path.realpath(k) in filenames}) | 348 if os.path.realpath(k) in filenames}) |
349 return -dispatcher.failed_count | 349 return -dispatcher.failed_count |
350 | 350 |
351 | 351 |
352 if __name__ == '__main__': | 352 if __name__ == '__main__': |
353 sys.exit(main()) | 353 sys.exit(main()) |
OLD | NEW |