diff options
author | Chad Rosier <mcrosier@apple.com> | 2011-10-24 21:56:50 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@apple.com> | 2011-10-24 21:56:50 +0000 |
commit | 7f53d592ffbef0225a95cbd97d653307f546a347 (patch) | |
tree | ee0d831dbdb5279006bd4867efc636a69b1dd60f /utils | |
parent | 10b90a9bbf7dcae1568c03a03f9606f5395f2144 (diff) | |
download | external_llvm-7f53d592ffbef0225a95cbd97d653307f546a347.zip external_llvm-7f53d592ffbef0225a95cbd97d653307f546a347.tar.gz external_llvm-7f53d592ffbef0225a95cbd97d653307f546a347.tar.bz2 |
Add options to enable each individual level for the show-diagnostics tool.
rdar://9683410
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142856 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/show-diagnostics | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/utils/show-diagnostics b/utils/show-diagnostics index 3a69793..b8ea8ea 100755 --- a/utils/show-diagnostics +++ b/utils/show-diagnostics @@ -5,15 +5,40 @@ import plistlib 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 @@ Utility for dumping Clang-style logged diagnostics.\ 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() |