[PATCH] Allow for the use of StringRef command line options instead of cl::opt<std::string>
plotfi at apple.com
Fri Oct 4 14:56:05 PDT 2013
On Oct 4, 2013, at 11:24 AM, Chandler Carruth <chandlerc at google.com> wrote:
> On Fri, Oct 4, 2013 at 2:23 PM, Puyan Lotfi <plotfi at apple.com> wrote:
> The reason why I think this option is good is to avoid allocating memory twice and avoid calling malloc when the strings are already going to persist (despite the small performance impact).
> The performance impact is not just small, it is unmeasurable small. It isn't worth the cost of this email discussion or writing the second interface to get this optimization. This is all really premature optimization for a case that simply doesn't matter.
> I understand your reasons for not wanting a buggy interface that clients would use and have all kinds of unexpected use-after-free bugs, but I’m not proposing this as a default.
> It doesn't matter what is the default. If we have a bug-prone interface, someone will call it, and will write a bug. I don't understand why you would want to spend your time including such an interface when it will provide no observable benefit and will widen the interface, potentially introducing bugs.
Alright, this sounds fine then. I’ll produce a LLVMContext patch that will be used by ParseCommandLine to keep string duplicates. If that seems reasonable, I’ll work on the patch and send it out some time in the near future. I’ll more than likely just use the global LLVMContext in the CommandLine library. If there are any other concerns, please let me know.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-commits