summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2012-08-02 00:41:40 +0000
committerAnna Zaks <ganna@apple.com>2012-08-02 00:41:40 +0000
commit45a992b5f063e159b4f38eb1f5ab9cea82d3f5be (patch)
tree18447eca50e3e64e093377736f57a336c4951988 /clang
parente736b97efffb79ceeced268163967248d56dbbda (diff)
downloadbcm5719-llvm-45a992b5f063e159b4f38eb1f5ab9cea82d3f5be.tar.gz
bcm5719-llvm-45a992b5f063e159b4f38eb1f5ab9cea82d3f5be.zip
[analyzer] CmpRuns should include file name in the issue identifier.
This prevents us from treating the issues from different files with the same function names and same offsets as the same. The issue identifier now includes the file name. Also added a way to strip off the root directories form the source file names. llvm-svn: 161150
Diffstat (limited to 'clang')
-rwxr-xr-xclang/utils/analyzer/CmpRuns.py43
1 files changed, 26 insertions, 17 deletions
diff --git a/clang/utils/analyzer/CmpRuns.py b/clang/utils/analyzer/CmpRuns.py
index ff48aa73b3e..f2961cf0acf 100755
--- a/clang/utils/analyzer/CmpRuns.py
+++ b/clang/utils/analyzer/CmpRuns.py
@@ -16,8 +16,12 @@ Usage:
# Load the results of both runs, to obtain lists of the corresponding
# AnalysisDiagnostic objects.
- resultsA = loadResults(dirA, opts, deleteEmpty)
- resultsB = loadResults(dirB, opts, deleteEmpty)
+ #
+ # root - the name of the root directory, which will be disregarded when
+ # determining the source file name
+ #
+ resultsA = loadResults(dirA, opts, root, deleteEmpty)
+ resultsB = loadResults(dirB, opts, root, deleteEmpty)
# Generate a relation from diagnostics in run A to diagnostics in run B
# to obtain a list of triples (a, b, confidence).
@@ -54,10 +58,10 @@ class AnalysisDiagnostic:
def getIssueIdentifier(self) :
id = ''
if 'issue_context' in self._data :
- id += self._data['issue_context']
+ id += self._data['issue_context'] + ":"
if 'issue_hash' in self._data :
- id += str(self._data['issue_hash'])
- return id
+ id += str(self._data['issue_hash']) + ":"
+ return id + ":" + self.getFileName()
def getReport(self):
if self._htmlReport is None:
@@ -96,8 +100,9 @@ class multidict:
#
class CmpOptions:
- def __init__(self, verboseLog=None, root=""):
- self.root = root
+ def __init__(self, verboseLog=None, rootA="", rootB=""):
+ self.rootA = rootA
+ self.rootB = rootB
self.verboseLog = verboseLog
class AnalysisReport:
@@ -106,20 +111,21 @@ class AnalysisReport:
self.files = files
class AnalysisRun:
- def __init__(self, path, opts):
+ def __init__(self, path, root, opts):
self.path = path
+ self.root = root
self.reports = []
self.diagnostics = []
self.opts = opts
def getSourceName(self, path):
- if path.startswith(self.opts.root):
- return path[len(self.opts.root):]
+ if path.startswith(self.root):
+ return path[len(self.root):]
return path
-def loadResults(path, opts, deleteEmpty=True):
- run = AnalysisRun(path, opts)
-
+def loadResults(path, opts, root = "", deleteEmpty=True):
+ run = AnalysisRun(path, root, opts)
+
for f in os.listdir(path):
if (not f.startswith('report') or
not f.endswith('plist')):
@@ -209,8 +215,8 @@ def compareResults(A, B):
def dumpScanBuildResultsDiff(dirA, dirB, opts, deleteEmpty=True):
# Load the run results.
- resultsA = loadResults(dirA, opts, deleteEmpty)
- resultsB = loadResults(dirB, opts, deleteEmpty)
+ resultsA = loadResults(dirA, opts, opts.rootA, deleteEmpty)
+ resultsB = loadResults(dirB, opts, opts.rootB, deleteEmpty)
# Open the verbose log, if given.
if opts.verboseLog:
@@ -259,8 +265,11 @@ def dumpScanBuildResultsDiff(dirA, dirB, opts, deleteEmpty=True):
def main():
from optparse import OptionParser
parser = OptionParser("usage: %prog [options] [dir A] [dir B]")
- parser.add_option("", "--root", dest="root",
- help="Prefix to ignore on source files",
+ parser.add_option("", "--rootA", dest="rootA",
+ help="Prefix to ignore on source files for directory A",
+ action="store", type=str, default="")
+ parser.add_option("", "--rootB", dest="rootB",
+ help="Prefix to ignore on source files for directory B",
action="store", type=str, default="")
parser.add_option("", "--verbose-log", dest="verboseLog",
help="Write additional information to LOG [default=None]",
OpenPOWER on IntegriCloud