[LLVMdev] SmallString for CommandLine options?

Talin viridia at gmail.com
Tue Sep 6 19:52:26 PDT 2011


On Tue, Sep 6, 2011 at 3:57 PM, Chris Lattner <clattner at apple.com> wrote:

>
> On Sep 4, 2011, at 9:14 PM, Talin wrote:
>
> > I've managed to eliminate nearly all uses of std::string from my
> frontend. About the only ones remaining are all of the occurrences of
> cl::opt<std::string>. Is it likely that at some point we'll see support for
> SmallString in the command-line lib?
>
> The better fix is to switch cl::opt to allow StringRef: there is no
> specific reason to copy strings out of argv. The only thing to watch out for
> is the "parsecommandlineoptions" API, which doesn't necessarily own the
> underlying string pointers.
>
> It looks like it uses StringRef already internally. Although it also
appears to use a mix of std::vector and SmallVector. I haven't really looked
at it that deeply.


> -Chris
>
>


-- 
-- Talin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110906/5421f507/attachment.html>


More information about the llvm-dev mailing list