Hi,
I recently decided to convert the argument parsing of a llvm project of
mine to the official LLVM CommandLine library. Specifically, my program
takes as as the first positional argument a command, which has to be in a
set of commands (similar to git). EG
myprog [options] <command> [command's arguments]
In LLVM CommandLine lingo, I needed a Positional argument with a Enum Value
mapping. Unfortunately for me, positionals and value mapping don't mix.
This:
static cl::opt<Commands>
Command(cl::Positional,
cl::Required,
cl::init(INVALID),
cl::desc("<command>"),
cl::value_desc("Commands:"),
cl::values(....));
compiles and runs, but the program doesn't parse the <command>
argument in
the expected way. Rather than do the smart thing, which would have been to
write a custom parser class, I decided to dig into CommandLine and fix the
problem at the source. And after spending way too long stepping through
CommandLine, I have a ugly hack that allows the cl::Positional flag and
values() to play nicely together.
So my questions are:
1. Would anyone find this useful - should I submit my changes to the trunk?
.. and if the answer to 1. is non-negative
2. How should I test the changes? They work for my limited use cases, but I
have no idea I didn't break existing LLVM tools.
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20130127/e77a15ca/attachment.html>