[PATCH] StringRef::copy should never copy empty strings
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 23 13:57:46 PDT 2016
Presumably you could just "return *this" (or "return StringRef()")
Perhaps you could test that the allocator is not invoked for that copy
On Wed, Mar 23, 2016 at 11:36 AM, Pete Cooper <peter_cooper at apple.com>
> Hi Mehdi, David
> This is a spin off from the discussion on Allocator.h and requesting that
> we allocate 0 bytes.
> Independent from whatever gets decided on Allocate behaviour, I think it
> would be best if StringRef::copy returns StringRef(nullptr, 0) whenever we
> try to copy an empty string. StringRef(“”) would also be fine if you
> This makes that change and adds test to the unit test for the new behavior.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-commits