diff options
author | Fangrui Song <i@maskray.me> | 2023-06-07 08:06:05 -0700 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2023-06-07 08:06:05 -0700 |
commit | 926e51c1370c711946e4b04101008773ea9d2052 (patch) | |
tree | e3335263bfa4d8e6029b4a9fb3d3864b0c09e9ec /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 66a562d22e708ba40b8443b58e504ac3f983ba59 (diff) | |
download | llvm-926e51c1370c711946e4b04101008773ea9d2052.zip llvm-926e51c1370c711946e4b04101008773ea9d2052.tar.gz llvm-926e51c1370c711946e4b04101008773ea9d2052.tar.bz2 |
[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 76ff1d915c9c42823a3f2b08ff936cf7a48933c5 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
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions