summaryrefslogtreecommitdiffstats
path: root/clang/tools/scan-build-py/libscanbuild/report.py
diff options
context:
space:
mode:
authorIlya Biryukov <ibiryukov@google.com>2018-03-01 12:43:39 +0000
committerIlya Biryukov <ibiryukov@google.com>2018-03-01 12:43:39 +0000
commitd49e75afbdad10e86ef5bfb6d53b86e2f7c63e50 (patch)
treea485d726e2dd09f22774afd1a91ba7563870676b /clang/tools/scan-build-py/libscanbuild/report.py
parentb068b037937d6088255562858ee82381bb1de424 (diff)
downloadbcm5719-llvm-d49e75afbdad10e86ef5bfb6d53b86e2f7c63e50.tar.gz
bcm5719-llvm-d49e75afbdad10e86ef5bfb6d53b86e2f7c63e50.zip
Revert "[analyzer] Support for naive cross translation unit analysis"
Also revert "[analyzer] Fix a compiler warning" This reverts commits r326323 and r326324. Reason: the commits introduced a cyclic dependency in the build graph. This happens to work with cmake, but breaks out internal integrate. llvm-svn: 326432
Diffstat (limited to 'clang/tools/scan-build-py/libscanbuild/report.py')
-rw-r--r--clang/tools/scan-build-py/libscanbuild/report.py22
1 files changed, 9 insertions, 13 deletions
diff --git a/clang/tools/scan-build-py/libscanbuild/report.py b/clang/tools/scan-build-py/libscanbuild/report.py
index b3753c1d9d4..54b9695d927 100644
--- a/clang/tools/scan-build-py/libscanbuild/report.py
+++ b/clang/tools/scan-build-py/libscanbuild/report.py
@@ -13,6 +13,7 @@ import os
import os.path
import sys
import shutil
+import itertools
import plistlib
import glob
import json
@@ -254,29 +255,24 @@ def read_crashes(output_dir):
def read_bugs(output_dir, html):
- # type: (str, bool) -> Generator[Dict[str, Any], None, None]
""" Generate a unique sequence of bugs from given output directory.
Duplicates can be in a project if the same module was compiled multiple
times with different compiler options. These would be better to show in
the final report (cover) only once. """
- def empty(file_name):
- return os.stat(file_name).st_size == 0
+ parser = parse_bug_html if html else parse_bug_plist
+ pattern = '*.html' if html else '*.plist'
duplicate = duplicate_check(
lambda bug: '{bug_line}.{bug_path_length}:{bug_file}'.format(**bug))
- # get the right parser for the job.
- parser = parse_bug_html if html else parse_bug_plist
- # get the input files, which are not empty.
- pattern = os.path.join(output_dir, '*.html' if html else '*.plist')
- bug_files = (file for file in glob.iglob(pattern) if not empty(file))
-
- for bug_file in bug_files:
- for bug in parser(bug_file):
- if not duplicate(bug):
- yield bug
+ bugs = itertools.chain.from_iterable(
+ # parser creates a bug generator not the bug itself
+ parser(filename)
+ for filename in glob.iglob(os.path.join(output_dir, pattern)))
+
+ return (bug for bug in bugs if not duplicate(bug))
def parse_bug_plist(filename):
OpenPOWER on IntegriCloud