[cfe-dev] Interest in StringRef'ize APIs Open Project

Sean Silva chisophugis at gmail.com
Tue May 19 14:28:09 PDT 2015


On Tue, May 19, 2015 at 9:56 AM, Renato Golin <renato.golin at linaro.org>
wrote:

> On 19 May 2015 at 17:49, David Chisnall <David.Chisnall at cl.cam.ac.uk>
> wrote:
> > Going from std::string to StringRef involves going from an explicit copy
> to something with nontrivial ownership semantics.  The converse transform
> would be trivial (it’s always safe to use a std::string instead of a
> StringRef, you’re just going to end up with lots of redundant copies), but
> going in this direction requires reasoning about the surrounding code.
>
> The idea is to go from std::string to StringRef/Twine, not the other
> way around, so the problems are usually non-trivial.
>
>
A related problem is foo(...,T* Elems, int NElem,...) ->
foo(...,ArrayRef<T> Arr,...)

I think we've been pretty good about this lately, but that transformation
is highly mechanical and there are probably a fair number of cases
remaining.

-- Sean Silva


> cheers,
> --renato
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150519/14684225/attachment.html>


More information about the cfe-dev mailing list