- Hide unrelated options.
- Add "OVERVIEW: " to yaml2obj -h/--help.
- Place options under a yaml2obj category.
- Disallow -docnum. Currently -docnum is the only yaml2obj specific long option that is affected.
- Specify cl::init("-") and cl::Prefix for OutputFilename. The latter allows -ofile
Details
- Reviewers
grimar jhenderson - Commits
- rGa29a9a34f49f: [yaml2obj] Refactor command line parsing
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
Unit tests: unknown.
clang-tidy: pass.
clang-format: pass.
Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt
Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.
Unit tests: unknown.
clang-tidy: pass.
clang-format: pass.
Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt
Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.
Unit tests: unknown.
clang-tidy: pass.
clang-format: pass.
Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt
Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.
With this patch applied I observe the different behavior between --help-list and -help-list:
umb@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@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@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@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
llvm/test/tools/yaml2obj/help.test | ||
---|---|---|
4 | I'd use "# RUN:" for consistency with our other tests. | |
14 | Would --implicit-check-not="Options:" be a better way to test it? | |
llvm/test/tools/yaml2obj/output-file.yaml | ||
6 | The test name is "invalid output file", but the new test case checks the Perhaps you can rename the test file and keep the new test here. | |
18 | Misaligned. |
--help-list is -h -e -l -p ... now. ParseCommandLineOptions prints help information after parsing -h and quits, so -e is not rejected.
This change is to make cl::Prefix short options more reliable (cannot conflict with long option names). (We only have one yaml2obj specific long option, so there should not be any problem..)
llvm/test/tools/yaml2obj/output-file.yaml | ||
---|---|---|
6 | It was already renamed :) |
Unit tests: unknown.
clang-tidy: pass.
clang-format: pass.
Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt
Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.
llvm/test/tools/yaml2obj/help.test | ||
---|---|---|
6 | Delete --check-prefixes=CHECK,LIST | |
llvm/test/tools/yaml2obj/output-file.yaml | ||
13 | Actually, "No such file or directory" is only OS-dependent via the capitalization of the first letter. We have lots of other tests that check the message, using a regex for that first letter. | |
llvm/tools/yaml2obj/yaml2obj.cpp | ||
31–32 | I thought using static was more in keeping with LLVM-style? | |
51 | from a YAML |
Address review comments
llvm/tools/yaml2obj/yaml2obj.cpp | ||
---|---|---|
31–32 | LLVM style prefers static. However, namespaces are used in other places, e.g. llvm-nm. llvm-readobj interestingly uses a named namespace. static makes the code a bit more verbose but I can change you are strong about this. |
Unit tests: fail. 62501 tests passed, 8 failed and 844 were skipped.
failed: LLVM.tools/yaml2obj/help.test failed: lld.ELF/compressed-input-alignment.test failed: lld.ELF/invalid/bad-reloc-target.test failed: lld.ELF/invalid/common-symbol-alignment.test failed: lld.ELF/invalid/dynamic-section-broken.test failed: lld.ELF/invalid/symtab-sh-info.s failed: lld.ELF/mips-elf-flags-err.test failed: lld.ELF/mips-fp-flags-err.test
clang-tidy: pass.
clang-format: fail. Please format your changes with clang-format by running git-clang-format HEAD^ or applying this patch.
Build artifacts: clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml
Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.
I'd use "# RUN:" for consistency with our other tests.