diff options
author | Daniel Dunbar <daniel@zuster.org> | 2013-01-25 23:12:17 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2013-01-25 23:12:17 +0000 |
commit | 856e06bda5d20f6926d6b9e7f0e68f6795b435ba (patch) | |
tree | 8c5cb522f7c20716ee1fa7ead52b717ad2d1d241 /utils | |
parent | 23799e3ec4b341753e4fb63a7e995cf4ac3b6066 (diff) |
[utils] Kill another no-longer-useful utility script.
- We are long past the days of getting clang to fail in mass on swaths of code,
fortunately.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173523 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/SummarizeErrors | 117 |
1 files changed, 0 insertions, 117 deletions
diff --git a/utils/SummarizeErrors b/utils/SummarizeErrors deleted file mode 100755 index b6e9122b74..0000000000 --- a/utils/SummarizeErrors +++ /dev/null @@ -1,117 +0,0 @@ -#!/usr/bin/env python - -import os, sys, re - -class multidict: - def __init__(self, elts=()): - self.data = {} - for key,value in elts: - self[key] = value - - def __getitem__(self, item): - return self.data[item] - def __setitem__(self, key, value): - if key in self.data: - self.data[key].append(value) - else: - self.data[key] = [value] - def items(self): - return self.data.items() - def values(self): - return self.data.values() - def keys(self): - return self.data.keys() - def __len__(self): - return len(self.data) - -kDiagnosticRE = re.compile(': (error|warning): (.*)') -kAssertionRE = re.compile('Assertion failed: (.*, function .*, file .*, line [0-9]+\\.)') - -def readInfo(path, opts): - lastProgress = [-100,0] - def progress(pos): - pct = (100. * pos) / (size * 2) - if (pct - lastProgress[0]) >= 10: - lastProgress[0] = pct - print '%d/%d = %.2f%%' % (pos, size*2, pct) - - f = open(path) - data = f.read() - f.close() - - if opts.truncate != -1: - data = data[:opts.truncate] - - size = len(data) - warnings = multidict() - errors = multidict() - for m in kDiagnosticRE.finditer(data): - progress(m.end()) - if m.group(1) == 'error': - d = errors - else: - d = warnings - d[m.group(2)] = m - warnings = warnings.items() - errors = errors.items() - assertions = multidict() - for m in kAssertionRE.finditer(data): - print '%d/%d = %.2f%%' % (size + m.end(), size, (float(m.end()) / (size*2)) * 100.) - assertions[m.group(1)] = m - assertions = assertions.items() - - # Manual scan for stack traces - aborts = multidict() - if 0: - prevLine = None - lnIter = iter(data.split('\n')) - for ln in lnIter: - m = kStackDumpLineRE.match(ln) - if m: - stack = [m.group(2)] - for ln in lnIter: - m = kStackDumpLineRE.match(ln) - if not m: - break - stack.append(m.group(2)) - if prevLine is None or not kAssertionRE.match(prevLine): - aborts[tuple(stack)] = stack - prevLine = ln - - sections = [ - (warnings, 'Warnings'), - (errors, 'Errors'), - (assertions, 'Assertions'), - (aborts.items(), 'Aborts'), - ] - - if opts.ascending: - sections.reverse() - - for l,title in sections: - l.sort(key = lambda (a,b): -len(b)) - if l: - print '-- %d %s (%d kinds) --' % (sum([len(b) for a,b in l]), title, len(l)) - for name,elts in l: - print '%5d:' % len(elts), name - -def main(): - global options - from optparse import OptionParser - parser = OptionParser("usage: %prog [options] {inputs}") - parser.add_option("", "--ascending", dest="ascending", - help="Print output in ascending order of severity.", - action="store_true", default=False) - parser.add_option("", "--truncate", dest="truncate", - help="Truncate input file (for testing).", - type=int, action="store", default=-1) - (opts, args) = parser.parse_args() - - if not args: - parser.error('No inputs specified') - - for arg in args: - readInfo(arg, opts) - -if __name__=='__main__': - main() |