llvm.org GIT mirror llvm / 906b31a
[opt-viewer] Make filter_=None by default in get_remarks and gather_results Right now, if you try to use optdiff.py on any opt records, it will fail because its calls to gather_results weren't updated to support filtering. Since filters are supposed to be optional, this makes them None by default in get_remarks and in gather_results. This allows other tools that don't support filtering to still use the functions as is. Differential Revision: https://reviews.llvm.org/D59894 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357106 91177308-0d34-0410-b5e6-96231b3b80d8 Jessica Paquette 4 months ago
1 changed file(s) with 6 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
264264 return "red"
265265
266266
267 def get_remarks(input_file, filter_):
267 def get_remarks(input_file, filter_=None):
268268 max_hotness = 0
269269 all_remarks = dict()
270270 file_remarks = defaultdict(functools.partial(defaultdict, list))
272272 with open(input_file) as f:
273273 docs = yaml.load_all(f, Loader=Loader)
274274
275 filter_e = re.compile(filter_)
275 filter_e = None
276 if filter_:
277 filter_e = re.compile(filter_)
276278 for remark in docs:
277279 remark.canonicalize()
278280 # Avoid remarks withoug debug location or if they are duplicated
279281 if not hasattr(remark, 'DebugLoc') or remark.key in all_remarks:
280282 continue
281283
282 if filter_ and not filter_e.search(remark.Pass):
284 if filter_e and not filter_e.search(remark.Pass):
283285 continue
284286
285287 all_remarks[remark.key] = remark
296298 return max_hotness, all_remarks, file_remarks
297299
298300
299 def gather_results(filenames, num_jobs, should_print_progress, filter_):
301 def gather_results(filenames, num_jobs, should_print_progress, filter_=None):
300302 if should_print_progress:
301303 print('Reading YAML files...')
302304 if not Remark.demangler_proc: