[llvm-commits] [llvm] r142856 - /llvm/trunk/utils/show-diagnostics
Chad Rosier
mcrosier at apple.com
Mon Oct 24 14:56:50 PDT 2011
Author: mcrosier
Date: Mon Oct 24 16:56:50 2011
New Revision: 142856
URL: http://llvm.org/viewvc/llvm-project?rev=142856&view=rev
Log:
Add options to enable each individual level for the show-diagnostics tool.
rdar://9683410
Modified:
llvm/trunk/utils/show-diagnostics
Modified: llvm/trunk/utils/show-diagnostics
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/show-diagnostics?rev=142856&r1=142855&r2=142856&view=diff
==============================================================================
--- llvm/trunk/utils/show-diagnostics (original)
+++ llvm/trunk/utils/show-diagnostics Mon Oct 24 16:56:50 2011
@@ -5,15 +5,40 @@
def main():
from optparse import OptionParser, OptionGroup
parser = OptionParser("""\
-usage: %prog [options] <path>
+Usage: %prog [options] <path>
Utility for dumping Clang-style logged diagnostics.\
""")
+ parser.add_option("-a", "--all", action="store_true", dest="all",
+ default=False, help="dump all messages.")
+ parser.add_option("-e", "--error", action="store_true", dest="error",
+ default=False, help="dump 'error' messages.")
+ parser.add_option("-f", "--fatal", action="store_true", dest="fatal",
+ default=False, help="dump 'fatal error' messages.")
+ parser.add_option("-i", "--ignored", action="store_true", dest="ignored",
+ default=False, help="dump 'ignored' messages.")
+ parser.add_option("-n", "--note", action="store_true", dest="note",
+ default=False, help="dump 'note' messages.")
+ parser.add_option("-w", "--warning", action="store_true", dest="warning",
+ default=False, help="dump 'warning' messages.")
(opts, args) = parser.parse_args()
if len(args) != 1:
parser.error("invalid number of arguments")
+ levels = {'error': False, 'fatal error': False, 'ignored': False,
+ 'note': False, 'warning': False}
+ if opts.error:
+ levels['error'] = True
+ if opts.fatal:
+ levels['fatal error'] = True
+ if opts.ignored:
+ levels['ignored'] = True
+ if opts.note:
+ levels['note'] = True
+ if opts.warning:
+ levels['warning'] = True
+
path, = args
# Read the diagnostics log.
@@ -44,9 +69,10 @@
file = file_diags.get('main-file')
print "*** %s ***" % file
for d in file_diags.get('diagnostics', ()):
- print "%s:%s:%s: %s: %s" % (
- d.get('filename'), d.get('line'), d.get('column'),
- d.get('level'), d.get('message'))
+ 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'))
if __name__ == "__main__":
main()
More information about the llvm-commits
mailing list