Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Unified Diff: tools/clang/scripts/run_tool.py

Issue 1010073002: clang: Add a tool for MessageLoop refactoring (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed some hacks. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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},
dcheng 2015/05/26 20:35:44 I think it's OK to just have this be "all_filename
clang_format_diff_path)
if dispatcher.failed_count != 0:
return 2

Powered by Google App Engine
This is Rietveld 408576698