[llvm-dev] Is it time to allow StringRef to be constructed from nullptr?

Zachary Turner via llvm-dev llvm-dev at lists.llvm.org
Mon Sep 26 08:54:59 PDT 2016


I put up a CL to remove the assert

https://reviews.llvm.org/D24904

I'm not seeing much objection to this proposal but I posted on a weekend,
so maybe someone will have something to say now. If there's no objections
I'll wait a few hours after getting an lgtm to commit


On Mon, Sep 26, 2016 at 2:54 AM Joerg Sonnenberger via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> On Sun, Sep 25, 2016 at 04:10:24PM +0000, Zachary Turner via llvm-dev
> wrote:
> > 2) [nullptr, nullptr+0) is a valid range.  Why shouldn't we be able to
> > construct a StringRef from an otherwise perfectly valid range?
>
> The problem is that for a lot of functions, esp. the mem* family, NULL
> as argument is triggering UB, even if size is 0. Since the GNU folks
> started to attribute the functions like that, certain compilers will
> pretty aggressively fold code based on that.
>
> Joerg
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160926/cb81770e/attachment.html>


More information about the llvm-dev mailing list