aboutsummaryrefslogtreecommitdiff
path: root/utils/clang-parse-diagnostics-file
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2012-12-22 00:47:06 +0000
committerDaniel Dunbar <daniel@zuster.org>2012-12-22 00:47:06 +0000
commit70d4e75a37fcd98e9a29073ef6d84fad6663bb02 (patch)
treea69e60f52e1a6e457b69d9663b48f5f3b7b423a7 /utils/clang-parse-diagnostics-file
parent629fb82419d9bfff6ae475363bcce66192dfcc8e (diff)
[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
Diffstat (limited to 'utils/clang-parse-diagnostics-file')
-rwxr-xr-xutils/clang-parse-diagnostics-file36
1 files changed, 27 insertions, 9 deletions
diff --git a/utils/clang-parse-diagnostics-file b/utils/clang-parse-diagnostics-file
index b8ea8eae31..59b13f3065 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.\
</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))
- # 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()