[lldb-dev] LLDB Evolution - Final Form

Zachary Turner via lldb-dev lldb-dev at lists.llvm.org
Tue Sep 20 15:06:35 PDT 2016

On Tue, Sep 20, 2016 at 2:51 PM Greg Clayton <gclayton at apple.com> wrote:

> > On Sep 20, 2016, at 2:49 PM, Mehdi Amini <mehdi.amini at apple.com> wrote:
> >
> >
> >> On Sep 20, 2016, at 2:46 PM, Zachary Turner <zturner at google.com> wrote:
> >>
> >> Occasionally (and in my experience *very* occasionally), you need to
> treat "" as different from null.
> doesn't StringRef store an actual pointer to ""? This would mean
> StringRef::data() would return non null, but StringRef::size() would return
> 0. So I believe that isn't a problem with StringRef

Right, it's only a problem when you need to write a function that returns
or accepts a string, and null has to be treated differently than empty.  As
Mehdi said, one option is an Optional<StringRef>, although I admit that
there are times where pointers would still be more convenient.  They're
still used in some places in llvm and clang for example, just not nearly as
often as StringRef.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20160920/9d034a31/attachment.html>

More information about the lldb-dev mailing list