[Patch] Allow to copy construct the values in llvm::StringMap

dblaikie at gmail.com dblaikie at gmail.com
Thu Jan 2 16:02:57 PST 2014


Committed an alternative fix for this in r198374 and included your test
case in r198377. Thanks for the patch/help!

(we could make this support move-only elements too one day, but I didn't
have an immediate incentive to do that)
On Wed Jan 01 2014 at 4:28:34 PM, Maciej Piechotka <uzytkownik2 at gmail.com>
wrote:

> Added in new patch
>
> On Wed, 2014-01-01 at 19:12 +0000, dblaikie at gmail.com wrote:
> > Unit tests would be nice
> >
> > On Tue Dec 31 2013 at 9:15:41 AM, Maciej Piechotka
> > <uzytkownik2 at gmail.com> wrote:
> >         On Tue, 2013-12-31 at 15:30 +0100, Maciej Piechotka wrote:
> >         > Hi,
> >         >
> >         > Sorry for double posting - it looks like I run into problems
> >         with my MUA
> >         > and I believe my previous message just disappear.
> >         >
> >         > It looks like currently it is hard to add value to
> >         llvm::StringMap which
> >         > does not have a default constructor (i.e. user needs to
> >         allocate
> >         > llvm::StringMapEntry by hand, construct it and fill it
> >         effectivly
> >         > reimplementing llvm::StringMapEntry::Create) such as
> >         llvm::Regex and it
> >         > is not possible to construct not-copy constructable value
> >         without
> >         > default constructor in C++11 by the 'hard' way.
> >         >
> >         > The attached patch allows to just copy the value when lvalue
> >         reference
> >         > is passed to llvm::StringMapEntry::Create. I thought about
> >         adding the
> >         > method for C++11:
> >         >
> >         >     template<typename... Args>
> >         >     MapEntryTy &GetOrCreateValue(StringRef Key, Args &&...
> >         Val)
> >         >
> >         > But I'm not sure how it interacted with
> >         llvm::StringMapEntryInitializer
> >         > use case (there seems to be no use of it in current llvm
> >         codebase except
> >         > test and I'm not sure what's the usecase for it).
> >         >
> >         > Best regards
> >
> >         Updated patch - I wasn't aware of LLVM feature macros.
> >         _______________________________________________
> >         llvm-commits mailing list
> >         llvm-commits at cs.uiuc.edu
> >         http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140103/8f8224ed/attachment.html>


More information about the llvm-commits mailing list