[llvm-dev] RFC: Constructing StringRefs at compile time
Zachary Turner via llvm-dev
llvm-dev at lists.llvm.org
Tue Nov 29 08:18:16 PST 2016
I don't like the llvm_strlen approach as it is incompatible with
std::string_view which we may eventually move to. StringLiteral will still
interoperate nicely
On Tue, Nov 29, 2016 at 2:20 AM Malcolm Parsons <malcolm.parsons at gmail.com>
wrote:
> On 28 November 2016 at 20:51, Zachary Turner via llvm-dev
> <llvm-dev at lists.llvm.org> wrote:
> > The basic idea here is that you introduce a StringLiteral class and
> anywhere
> > you want to use a global constructor, you make sure to declare a
> constexpr
> > array instead of a normal array, and you make it of type StringLiteral.
>
> I prefer constexpr llvm_strlen() over StringLiteral because it doesn't
> require code changes outside StringRef - all StringRefs constructed
> from a literal can benefit. But there are concerns about MSVC.
> I prefer StringLiteral over UDL because the type requires code
> changes, but the values don't.
> I prefer StringLiteral over explicit StringRef constructor because it's
> safer.
>
> --
> Malcolm Parsons
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161129/d1c99052/attachment.html>
More information about the llvm-dev
mailing list