[cfe-commits] r167981 - /cfe/trunk/utils/analyzer/CmpRuns.py

Anna Zaks ganna at apple.com
Wed Nov 14 13:32:16 PST 2012


Author: zaks
Date: Wed Nov 14 15:32:16 2012
New Revision: 167981

URL: http://llvm.org/viewvc/llvm-project?rev=167981&view=rev
Log:
[analyzer] Ensure that CmpRuns recursively walks the output directory.

Modified:
    cfe/trunk/utils/analyzer/CmpRuns.py

Modified: cfe/trunk/utils/analyzer/CmpRuns.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/analyzer/CmpRuns.py?rev=167981&r1=167980&r2=167981&view=diff
==============================================================================
--- cfe/trunk/utils/analyzer/CmpRuns.py (original)
+++ cfe/trunk/utils/analyzer/CmpRuns.py Wed Nov 14 15:32:16 2012
@@ -148,45 +148,46 @@
     path = info.path
     run = AnalysisRun(info)
     
-    for f in os.listdir(path):
-        if (not f.endswith('plist')):
-            continue
-
-        p = os.path.join(path, f)
-        data = plistlib.readPlist(p)
-
-        # Ignore/delete empty reports.
-        if not data['files']:
-            if deleteEmpty == True:
-                os.remove(p)
-            continue
-
-        # Extract the HTML reports, if they exists.
-        if 'HTMLDiagnostics_files' in data['diagnostics'][0]:
-            htmlFiles = []
-            for d in data['diagnostics']:
-                # FIXME: Why is this named files, when does it have multiple
-                # files?
-                assert len(d['HTMLDiagnostics_files']) == 1
-                htmlFiles.append(d.pop('HTMLDiagnostics_files')[0])
-        else:
-            htmlFiles = [None] * len(data['diagnostics'])
-        
-        clang_version = ''
-        if 'clang_version' in data:
-            clang_version = data.pop('clang_version')
-        
-        report = AnalysisReport(run, data.pop('files'), clang_version)
-        diagnostics = [AnalysisDiagnostic(d, report, h) 
-                       for d,h in zip(data.pop('diagnostics'),
-                                      htmlFiles)]
-
-        assert not data
-        
-        report.diagnostics.extend(diagnostics)
-        run.reports.append(report)
-        run.diagnostics.extend(diagnostics)
-
+    for (dirpath, dirnames, filenames) in os.walk(path):
+        for f in filenames:
+            if (not f.endswith('plist')):
+                continue
+    
+            p = os.path.join(dirpath, f)
+            data = plistlib.readPlist(p)
+    
+            # Ignore/delete empty reports.
+            if not data['files']:
+                if deleteEmpty == True:
+                    os.remove(p)
+                continue
+    
+            # Extract the HTML reports, if they exists.
+            if 'HTMLDiagnostics_files' in data['diagnostics'][0]:
+                htmlFiles = []
+                for d in data['diagnostics']:
+                    # FIXME: Why is this named files, when does it have multiple
+                    # files?
+                    assert len(d['HTMLDiagnostics_files']) == 1
+                    htmlFiles.append(d.pop('HTMLDiagnostics_files')[0])
+            else:
+                htmlFiles = [None] * len(data['diagnostics'])
+            
+            clang_version = ''
+            if 'clang_version' in data:
+                clang_version = data.pop('clang_version')
+            
+            report = AnalysisReport(run, data.pop('files'), clang_version)
+            diagnostics = [AnalysisDiagnostic(d, report, h) 
+                           for d,h in zip(data.pop('diagnostics'),
+                                          htmlFiles)]
+    
+            assert not data
+            
+            report.diagnostics.extend(diagnostics)
+            run.reports.append(report)
+            run.diagnostics.extend(diagnostics)
+            
     return run
 
 def cmpAnalysisDiagnostic(d) :





More information about the cfe-commits mailing list