[PATCH] Allow for the use of StringRef command line options instead of cl::opt<std::string>

David Blaikie dblaikie at gmail.com
Sat Aug 10 13:04:44 PDT 2013


On Fri, Aug 9, 2013 at 2:31 PM, Puyan Lotfi <plotfi at apple.com> wrote:

> Hi All
>
> I have some changes ready for adding StringRef support to the llvm
> CommandLine library:
>
> - The purpose of the change is to reduce malloc/free costs associated with
> std::string since most of the time the cl options could point point to argv
> pointers.
> - cl::opt<std::string> still works and I kept it around because I noticed
> some tools generate string values for options at runtime.
>

Could you explain/point out examples of this? It seems sort of reasonable
to just say clients own strings for the life of the tools they invoke
(since that's the contract with the actual command line interaction -
argv's lifetime is managed beyond the scope of the user-written source) &
thus should always be StringRefs.


> - This patch also includes changes to several tools in llvm that use this
> library so that they could use cl:opt<StringRef> instead of
> cl:opt<std::string> wherever possible.
>
> Could someone on the list review my changes, give me some feedback, and
> later check in the changes when they look ready (as I do not have commit
> access).
>
> Thanks
>
> -Puyan
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130810/fb7448f7/attachment.html>


More information about the llvm-commits mailing list