From: Brian Gesiak Date: Fri, 23 Jun 2017 20:06:34 +0000 (+0000) Subject: [opt-viewer] Remove positional arg checks (NFC) X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ddb4efa8b2bec97dedf9580bca5fff38af6670ba;p=llvm [opt-viewer] Remove positional arg checks (NFC) Summary: opt-stats.py and opt-viewer.py's argument parsers both take a positional argument 'yaml_files'. Positional arguments in Python's argparse module are required by default, so the subsequent checks for `len(args.yaml_files) == 0` are unnecessary -- if the length was zero, then the call to `parser.parse_args()` would have thrown an error already. Because there is no way for `len(args.yaml_files)` to be zero at these points, removing the code is NFC. Reviewers: anemet, davidxl Reviewed By: anemet Subscribers: llvm-commits, fhahn Differential Revision: https://reviews.llvm.org/D34567 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306147 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/utils/opt-viewer/opt-stats.py b/utils/opt-viewer/opt-stats.py index 7ce935b492c..d67de7e359c 100755 --- a/utils/opt-viewer/opt-stats.py +++ b/utils/opt-viewer/opt-stats.py @@ -24,10 +24,6 @@ if __name__ == '__main__': help='Max job count (defaults to %(default)s, the current CPU count)') args = parser.parse_args() - if len(args.yaml_files) == 0: - parser.print_help() - sys.exit(1) - if args.jobs == 1: pmap = map else: diff --git a/utils/opt-viewer/opt-viewer.py b/utils/opt-viewer/opt-viewer.py index 5e076d86dbe..3f5503f26b1 100755 --- a/utils/opt-viewer/opt-viewer.py +++ b/utils/opt-viewer/opt-viewer.py @@ -216,10 +216,6 @@ if __name__ == '__main__': help='set source directory') args = parser.parse_args() - if len(args.yaml_files) == 0: - parser.print_help() - sys.exit(1) - if args.jobs == 1: pmap = map else: