X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=utils%2Fclang-parse-diagnostics-file;h=59b13f306505a8eca4859acdef2f85a5f33fcc08;hb=fbbab8b9598762b23d1cc870d4a7a1cba4158792;hp=b8ea8eae310f1be08d16a71b982a8043921d768e;hpb=3eae0c2fa627b6f6466f6ef843f380b84d6145ed;p=oota-llvm.git diff --git a/utils/clang-parse-diagnostics-file b/utils/clang-parse-diagnostics-file index b8ea8eae310..59b13f30650 100755 --- a/utils/clang-parse-diagnostics-file +++ b/utils/clang-parse-diagnostics-file @@ -1,5 +1,6 @@ #!/usr/bin/env python +import os import plistlib def main(): @@ -59,20 +60,37 @@ Utility for dumping Clang-style logged diagnostics.\ """ % data - # Load the diagnostics. + # Get the list of files and diagnostics to report. + to_report = [] diags = plistlib.readPlistFromString(data) + for file_diags in diags: + file = file_diags.get('main-file') + + # Ignore diagnostics for 'conftest.c', which is the file autoconf uses + # for its tests (which frequently will have warnings). + if os.path.basename(file) == 'conftest.c': + continue + + # Get the diagnostics for the selected levels. + selected_diags = [d + for d in file_diags.get('diagnostics', ()) + if levels[d.get('level')] or opts.all] + if selected_diags: + to_report.append((file, selected_diags)) - # Print out the diagnostics. + # If there are no diagnostics to report, show nothing. + if not to_report: + return + + # Otherwise, print out the diagnostics. print print "**** BUILD DIAGNOSTICS ****" - for i, file_diags in enumerate(diags): - file = file_diags.get('main-file') + for file,selected_diags in to_report: print "*** %s ***" % file - for d in file_diags.get('diagnostics', ()): - if levels[d.get('level')] or opts.all: - print " %s:%s:%s: %s: %s" % ( - d.get('filename'), d.get('line'), d.get('column'), - d.get('level'), d.get('message')) + for d in selected_diags: + print " %s:%s:%s: %s: %s" % ( + d.get('filename'), d.get('line'), d.get('column'), + d.get('level'), d.get('message')) if __name__ == "__main__": main()