[PATCH] D73982: [yaml2obj] Refactor command line parsing
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 5 00:05:02 PST 2020
grimar added a comment.
With this patch applied I observe the different behavior between `--help-list` and `-help-list`:
umb at ubuntu:~/LLVM/LLVM/llvm-project/build/bin$ ./yaml2obj -help-list
OVERVIEW: Create an object file from YAML description
USAGE: yaml2obj [options] <input file>
OPTIONS:
Generic Options:
--help - Display available options (--help-hidden for more)
--help-list - Display list of available options (--help-list-hidden for more)
--version - Display the version of this program
yaml2obj Options:
--docnum=<uint> - Read specified document from input (default = 1)
-o=<filename> - Output filename
umb at ubuntu:~/LLVM/LLVM/llvm-project/build/bin$ ./yaml2obj --help-list
OVERVIEW: Create an object file from YAML description
USAGE: yaml2obj [options] <input file>
OPTIONS:
--docnum=<uint> - Read specified document from input (default = 1)
--help - Display available options (--help-hidden for more)
-o=<filename> - Output filename
--version - Display the version of this program
The original behavior was:
umb at ubuntu:~/LLVM/LLVM/llvm-project/build/bin$ ./yaml2obj --help-list
USAGE: yaml2obj [options] <input>
OPTIONS:
--color - Use colors in output (default=autodetect)
--docnum=<uint> - Read specified document from input (default = 1)
--help - Display available options (--help-hidden for more)
-o=<filename> - Output filename
--version - Display the version of this program
umb at ubuntu:~/LLVM/LLVM/llvm-project/build/bin$ ./yaml2obj -help-list
USAGE: yaml2obj [options] <input>
OPTIONS:
--color - Use colors in output (default=autodetect)
--docnum=<uint> - Read specified document from input (default = 1)
--help - Display available options (--help-hidden for more)
-o=<filename> - Output filename
--version - Display the version of this program
================
Comment at: llvm/test/tools/yaml2obj/help.test:3
+
+RUN: yaml2obj -h | FileCheck %s --check-prefixes=CHECK,CATEG
+RUN: yaml2obj --help | FileCheck %s --check-prefixes=CHECK,CATEG
----------------
I'd use "# RUN:" for consistency with our other tests.
================
Comment at: llvm/test/tools/yaml2obj/help.test:13
+CATEG: yaml2obj Options:
+LIST-NOT: yaml2obj Options:
----------------
Would `--implicit-check-not="Options:"` be a better way to test it?
================
Comment at: llvm/test/tools/yaml2obj/output-file.yaml:6
+
+# RUN: rm -f %t
+# RUN: yaml2obj %s -o %t
----------------
The test name is "invalid output file", but the new test case checks the
valid usage of the "-o" option isn't?
Perhaps you can rename the test file and keep the new test here.
Also it probably deserves a comment about what is tested.
================
Comment at: llvm/test/tools/yaml2obj/output-file.yaml:18
+ Type: ET_REL
+ Machine: EM_NONE
----------------
Misaligned.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D73982/new/
https://reviews.llvm.org/D73982
More information about the llvm-commits
mailing list