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

Anna Zaks ganna at apple.com
Thu Nov 15 14:42:44 PST 2012


Author: zaks
Date: Thu Nov 15 16:42:44 2012
New Revision: 168105

URL: http://llvm.org/viewvc/llvm-project?rev=168105&view=rev
Log:
[analyzer] CmpRuns: move the clang_version info into the run (out of
report)

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=168105&r1=168104&r2=168105&view=diff
==============================================================================
--- cfe/trunk/utils/analyzer/CmpRuns.py (original)
+++ cfe/trunk/utils/analyzer/CmpRuns.py Thu Nov 15 16:42:44 2012
@@ -120,9 +120,8 @@
         self.verboseLog = verboseLog
 
 class AnalysisReport:
-    def __init__(self, run, files, clang_vers):
+    def __init__(self, run, files):
         self.run = run
-        self.clang_version = clang_vers
         self.files = files
         self.diagnostics = []
 
@@ -134,6 +133,10 @@
         self.reports = []
         # Cumulative list of all diagnostics from all the reports.
         self.diagnostics = []
+        self.clang_version = None
+    
+    def getClangVersion(self):
+        return self.clang_version
 
 
 # Backward compatibility API. 
@@ -156,6 +159,15 @@
             p = os.path.join(dirpath, f)
             data = plistlib.readPlist(p)
     
+            # We want to retrieve the clang version even if there are no 
+            # reports. Assume that all reports were created using the same 
+            # clang version (this is always true and is more efficient).
+            if ('clang_version' in data) :
+                if (run.clang_version == None) :
+                    run.clang_version = data.pop('clang_version')
+                else:
+                    data.pop('clang_version')
+                
             # Ignore/delete empty reports.
             if not data['files']:
                 if deleteEmpty == True:
@@ -173,11 +185,7 @@
             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)
+            report = AnalysisReport(run, data.pop('files'))
             diagnostics = [AnalysisDiagnostic(d, report, h) 
                            for d,h in zip(data.pop('diagnostics'),
                                           htmlFiles)]





More information about the cfe-commits mailing list