| Index: tools/clang/scripts/run_tool.py
|
| diff --git a/tools/clang/scripts/run_tool.py b/tools/clang/scripts/run_tool.py
|
| index 58a9a86570c6b3b203d5a0004ce56d04426db314..7190fbd16a799612fdab94dd5d3431820dfe21ef 100755
|
| --- a/tools/clang/scripts/run_tool.py
|
| +++ b/tools/clang/scripts/run_tool.py
|
| @@ -315,19 +315,25 @@ def main(argv):
|
|
|
| if len(argv) == 3 and argv[2] == '--all':
|
| filenames = set(_GetFilesFromCompileDB(argv[1]))
|
| + editable_filenames = filenames
|
| else:
|
| - filenames = set(_GetFilesFromGit(argv[2:]))
|
| + all_filenames = set(_GetFilesFromGit(argv[2:]))
|
| # Filter out files that aren't C/C++/Obj-C/Obj-C++.
|
| extensions = frozenset(('.c', '.cc', '.m', '.mm'))
|
| - filenames = [f for f in filenames
|
| + filenames = [f for f in all_filenames
|
| if os.path.splitext(f)[1] in extensions]
|
| + # Some files (e.g., headers) are not part of the compile database but can
|
| + # still be edited.
|
| + editable_extensions = frozenset(('.h', )) | extensions
|
| + editable_filenames = [f for f in all_filenames
|
| + if os.path.splitext(f)[1] in editable_extensions]
|
| dispatcher = _CompilerDispatcher(argv[0], argv[1], filenames)
|
| dispatcher.Run()
|
| # Filter out edits to files that aren't in the git repository, since it's not
|
| # useful to modify files that aren't under source control--typically, these
|
| # are generated files or files in a git submodule that's not part of Chromium.
|
| _ApplyEdits({k : v for k, v in dispatcher.edits.iteritems()
|
| - if os.path.realpath(k) in filenames},
|
| + if os.path.realpath(k) in editable_filenames},
|
| clang_format_diff_path)
|
| if dispatcher.failed_count != 0:
|
| return 2
|
|
|