-
Notifications
You must be signed in to change notification settings - Fork 11.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Option] Support special argument "--"
Many command line option implementations, including getopt_long and our Support/CommandLine.cpp, support `--` as an end-of-option indicator. All the subsequent arguments are then treated as positional arguments. D1387 added KIND_REMAINING_ARGS and 76ff1d9 dropped special handling of `--`. Users need to add `def DASH_DASH : Option<["--"], "", KIND_REMAINING_ARGS>;` and append `OPT_DASH_DASH` to the `OPT_INPUT` list., which is not ergonomic. Restore this feature under an option and modify llvm-strings to utilize the feature as an example. In the future, we probably should enable this feature by default and exclude some tools that handle `DASH_DASH` differently (clang, clang-scan-deps, etc. I suspect that many are workarounds for LLVMOption not supporting `--` as a built-in feature). Reviewed By: serge-sans-paille Differential Revision: https://reviews.llvm.org/D152286
- Loading branch information
Showing
6 changed files
with
55 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
## Show that -- stops option scanning. | ||
|
||
RUN: rm -rf %t && mkdir %t && cd %t | ||
RUN: echo abcd > -a | ||
RUN: llvm-strings -f -- -a | FileCheck %s | ||
CHECK: -a: abcd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters