[llvm-commits] [llvm] r170973 - /llvm/trunk/utils/clang-parse-diagnostics-file
Daniel Dunbar
daniel at zuster.org
Fri Dec 21 16:47:06 PST 2012
Author: ddunbar
Date: Fri Dec 21 18:47:06 2012
New Revision: 170973
URL: http://llvm.org/viewvc/llvm-project?rev=170973&view=rev
Log:
[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.
Modified:
llvm/trunk/utils/clang-parse-diagnostics-file
Modified: llvm/trunk/utils/clang-parse-diagnostics-file
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/clang-parse-diagnostics-file?rev=170973&r1=170972&r2=170973&view=diff
==============================================================================
--- llvm/trunk/utils/clang-parse-diagnostics-file (original)
+++ llvm/trunk/utils/clang-parse-diagnostics-file Fri Dec 21 18:47:06 2012
@@ -1,5 +1,6 @@
#!/usr/bin/env python
+import os
import plistlib
def main():
@@ -59,20 +60,37 @@
</array>
</plist>""" % 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))
+
+ # If there are no diagnostics to report, show nothing.
+ if not to_report:
+ return
- # Print out the diagnostics.
+ # 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()
More information about the llvm-commits
mailing list