From: Chris Lattner Date: Sat, 4 Sep 2010 18:45:02 +0000 (+0000) Subject: fix this to work with allocators that have reference type with compilers X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=061d21eaf8fcdb19b85db0755c208acbba7c8ef4;p=oota-llvm.git fix this to work with allocators that have reference type with compilers that diagnose invalid references to references. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113078 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/ADT/StringMap.h b/include/llvm/ADT/StringMap.h index 59ff6aa4f6a..1b20f4fdd9c 100644 --- a/include/llvm/ADT/StringMap.h +++ b/include/llvm/ADT/StringMap.h @@ -242,6 +242,9 @@ public: }; +template struct ReferenceAdder { typedef T& result; }; +template struct ReferenceAdder { typedef T result; }; + /// StringMap - This is an unconventional map that is specialized for handling /// keys that are "strings", which are basically ranges of bytes. This does some /// funky memory allocation and hashing things to make it extremely efficient, @@ -269,9 +272,10 @@ public: clear(); } - - AllocatorTy &getAllocator() { return Allocator; } - const AllocatorTy &getAllocator() const { return Allocator; } + typedef typename ReferenceAdder::result AllocatorRefTy; + typedef typename ReferenceAdder::result AllocatorCRefTy; + AllocatorRefTy getAllocator() { return Allocator; } + AllocatorCRefTy getAllocator() const { return Allocator; } typedef const char* key_type; typedef ValueTy mapped_type;