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

Maciej Piechotka uzytkownik2 at gmail.com
Wed Jan 1 16:28:39 PST 2014


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 --------------
A non-text attachment was scrubbed...
Name: 0001-Allow-to-CopyConstruct-the-values-in-llvm-StringMap.patch
Type: text/x-patch
Size: 4404 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140102/c2943de7/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140102/c2943de7/attachment.sig>


More information about the llvm-commits mailing list