llvm.org GIT mirror llvm / 70d4e75
[utils] Tweak utils/clang-parse-diagnostics-file to ignore autoconf diagnostics. - Also, don't print headers if we aren't going to print any diagnostics. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170973 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Dunbar 7 years ago
1 changed file(s) with 27 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
0 #!/usr/bin/env python
11
2 import os
23 import plistlib
34
45 def main():
5859
5960 """ % data
6061
61 # Load the diagnostics.
62 # Get the list of files and diagnostics to report.
63 to_report = []
6264 diags = plistlib.readPlistFromString(data)
65 for file_diags in diags:
66 file = file_diags.get('main-file')
6367
64 # Print out the diagnostics.
68 # Ignore diagnostics for 'conftest.c', which is the file autoconf uses
69 # for its tests (which frequently will have warnings).
70 if os.path.basename(file) == 'conftest.c':
71 continue
72
73 # Get the diagnostics for the selected levels.
74 selected_diags = [d
75 for d in file_diags.get('diagnostics', ())
76 if levels[d.get('level')] or opts.all]
77 if selected_diags:
78 to_report.append((file, selected_diags))
79
80 # If there are no diagnostics to report, show nothing.
81 if not to_report:
82 return
83
84 # Otherwise, print out the diagnostics.
6585 print
6686 print "**** BUILD DIAGNOSTICS ****"
67 for i, file_diags in enumerate(diags):
68 file = file_diags.get('main-file')
87 for file,selected_diags in to_report:
6988 print "*** %s ***" % file
70 for d in file_diags.get('diagnostics', ()):
71 if levels[d.get('level')] or opts.all:
72 print " %s:%s:%s: %s: %s" % (
73 d.get('filename'), d.get('line'), d.get('column'),
74 d.get('level'), d.get('message'))
89 for d in selected_diags:
90 print " %s:%s:%s: %s: %s" % (
91 d.get('filename'), d.get('line'), d.get('column'),
92 d.get('level'), d.get('message'))
7593
7694 if __name__ == "__main__":
7795 main()