Make find_opt_files vararg
authorAdam Nemet <anemet@apple.com>
Fri, 29 Sep 2017 05:20:53 +0000 (05:20 +0000)
committerAdam Nemet <anemet@apple.com>
Fri, 29 Sep 2017 05:20:53 +0000 (05:20 +0000)
This is slightly less verbose for the common case of a single build directory
and more intuitive when using this API directly from the interpreter.

llvm-svn: 314491

llvm/tools/opt-viewer/opt-diff.py
llvm/tools/opt-viewer/opt-stats.py
llvm/tools/opt-viewer/opt-viewer.py
llvm/tools/opt-viewer/optrecord.py

index 32d6e5a..6b20d82 100755 (executable)
@@ -46,8 +46,8 @@ if __name__ == '__main__':
     parser.add_argument('--output', '-o', default='diff.opt.yaml')
     args = parser.parse_args()
 
-    files1 = optrecord.find_opt_files([args.yaml_dir_or_file_1])
-    files2 = optrecord.find_opt_files([args.yaml_dir_or_file_2])
+    files1 = optrecord.find_opt_files(args.yaml_dir_or_file_1)
+    files2 = optrecord.find_opt_files(args.yaml_dir_or_file_2)
 
     print_progress = not args.no_progress_indicator
     all_remarks1, _, _ = optrecord.gather_results(files1, args.jobs, print_progress)
index 8fa88cc..5c415df 100755 (executable)
@@ -43,7 +43,7 @@ if __name__ == '__main__':
 
     print_progress = not args.no_progress_indicator
 
-    files = optrecord.find_opt_files(args.yaml_dirs_or_files)
+    files = optrecord.find_opt_files(*args.yaml_dirs_or_files)
     if not files:
         parser.error("No *.opt.yaml files found")
         sys.exit(1)
index ceb9e22..08fe2d5 100755 (executable)
@@ -258,7 +258,7 @@ if __name__ == '__main__':
 
     print_progress = not args.no_progress_indicator
 
-    files = optrecord.find_opt_files(args.yaml_dirs_or_files)
+    files = optrecord.find_opt_files(*args.yaml_dirs_or_files)
     if not files:
         parser.error("No *.opt.yaml files found")
         sys.exit(1)
index a167638..95b9089 100644 (file)
@@ -282,7 +282,7 @@ def gather_results(filenames, num_jobs, should_print_progress):
     return all_remarks, file_remarks, max_hotness != 0
 
 
-def find_opt_files(dirs_or_files):
+def find_opt_files(*dirs_or_files):
     all = []
     for dir_or_file in dirs_or_files:
         if os.path.isfile(dir_or_file):