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

Puyan Lotfi plotfi at apple.com
Tue Aug 13 09:53:15 PDT 2013


I’ve still not seen any feedback on this patch. Could someone take a look?

-Puyan

On Aug 12, 2013, at 10:12 AM, Puyan Lotfi <plotfi at apple.com> wrote:

> 
> On Aug 10, 2013, at 1:04 PM, David Blaikie <dblaikie at gmail.com> wrote:
> 
>> 
>> 
>> 
>> 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.
> 
> Example of which? Of tools generating string values at runtime? I noticed that lli has a cl::opt<string> for its output filename that it generates at runtime based on the input filename (it’s just changing the file extension). This happens at tools/llc/llc.cpp:103 in GetOutputStream().
> 
>>  
>> - 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
>> 
>> 
> 
> _______________________________________________
> 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/20130813/d7572f4d/attachment.html>


More information about the llvm-commits mailing list