Commit d857418d authored by lukasza's avatar lukasza Committed by Commit bot

Fix filtering of where edits are applied when --all switch is used.

Before this CL, when --all switch was used, then |filenames|
1) wouldn't include any header filenames (which should get rewritten)
2) would include generated files (which shouldn't get rewritten)
This would lead to incorrect filtering of edits/files that are passed to
_ApplyEdits function.

The new filtering behavior helps to ensure that we apply edits to header
files that are only included from generated files.  Doing this requires
1) running the tool on generated files (this is what --all switch
accomplishes even before this CL) and 2) ensuring that edits are applied
to the right files (this is what this CL does).  Examples of headers
that are only included from generated files can be found in
https://crbug.com/643779#c11

BUG=643779

Review-Url: https://codereview.chromium.org/2583623002
Cr-Commit-Position: refs/heads/master@{#439136}
parent 0145a58d
......@@ -319,11 +319,10 @@ def main():
if args.generate_compdb:
compile_db.GenerateWithNinja(args.compile_database)
filenames = set(_GetFilesFromGit(args.path_filter))
if args.all:
filenames = set(_GetFilesFromCompileDB(args.compile_database))
source_filenames = filenames
source_filenames = set(_GetFilesFromCompileDB(args.compile_database))
else:
filenames = set(_GetFilesFromGit(args.path_filter))
# Filter out files that aren't C/C++/Obj-C/Obj-C++.
extensions = frozenset(('.c', '.cc', '.cpp', '.m', '.mm'))
source_filenames = [f
......@@ -343,4 +342,4 @@ def main():
if __name__ == '__main__':
sys.exit(main())
\ No newline at end of file
sys.exit(main())
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment