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

Chandler Carruth chandlerc at google.com
Fri Oct 4 11:24:13 PDT 2013

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131004/8497a11d/attachment.html>

More information about the llvm-commits mailing list