[cfe-dev] Expand libtooling CommonOptionsParser arguments
Victor Vicente de Carvalho
victor.v.carvalho at gmail.com
Sun Jan 6 07:29:28 PST 2013
Ah, figured it out, just placing this code:
static llvm::cl::opt<std::string> OutputPath(
"o", llvm::cl::desc("Output file"), llvm::cl::Optional);
before calling:
CommonOptionsParser parser( argc, argv );
on my tool does some static black magic that automagically adds the option
to the application.
Thanks,
Victor
2013/1/5 Manuel Klimek <klimek at google.com>
> Take a look at the class comment in
> llvm/tools/clang/include/clang/Tooling/CommonOptionsParser.h
>
> If something doesn't work as described there (or if we can make it
> clearer) let me know :)
>
> Cheers,
> /Manuel
>
>
> On Sat, Jan 5, 2013 at 9:10 PM, Victor Vicente de Carvalho <
> victor.v.carvalho at gmail.com> wrote:
>
>> Hi Manuel,
>>
>> Haha, yes, It's exactly what I'm intending to do. The problem is that
>> CommonOptionsParser calls cl::ParseCommandLineOptions(argc, argv) and I was
>> trying to figure on how to inject custom arguments inside it.
>>
>>
>> Cheers,
>>
>> Victor
>>
>>
>> 2013/1/5 Manuel Klimek <klimek at google.com>
>>
>>> On Sat, Jan 5, 2013 at 8:10 PM, Victor Vicente de Carvalho <
>>> victor.v.carvalho at gmail.com> wrote:
>>>
>>>> Hello,
>>>>
>>>> I would like to expand CommonOptionsParser class with a new argument to
>>>> specify an output file (something like -o "generated.cpp"). What would be
>>>> the best way to do that?
>>>>
>>>
>>> As this sounds like something that is not common to pretty much all
>>> tools, I'd say - put it into the actual tool you're writing?
>>>
>>> Cheers,
>>> /Manuel
>>>
>>>
>>>>
>>>> _______________________________________________
>>>> cfe-dev mailing list
>>>> cfe-dev at cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130106/5e68007d/attachment.html>
More information about the cfe-dev
mailing list