OSDN Git Service

[opt-diff] Fix the case when the script is invoked with directories
authorAdam Nemet <anemet@apple.com>
Mon, 6 Mar 2017 19:15:22 +0000 (19:15 +0000)
committerAdam Nemet <anemet@apple.com>
Mon, 6 Mar 2017 19:15:22 +0000 (19:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297055 91177308-0d34-0410-b5e6-96231b3b80d8

utils/opt-viewer/opt-diff.py

index c51e05e..8c37786 100755 (executable)
@@ -21,6 +21,7 @@ import argparse
 from collections import defaultdict
 from multiprocessing import cpu_count, Pool
 import os, os.path
+import fnmatch
 
 def find_files(dir_or_file):
     if os.path.isfile(dir_or_file):
@@ -29,7 +30,8 @@ def find_files(dir_or_file):
     all = []
     for dir, subdirs, files in os.walk(dir_or_file):
         for file in files:
-            all.append( os.path.join(dir, file))
+            if fnmatch.fnmatch(file, "*.opt.yaml"):
+                all.append( os.path.join(dir, file))
     return all
 
 if __name__ == '__main__':