[llvm] r206612 - Allocator: Remove ReferenceAdder hack.

Benjamin Kramer benny.kra at googlemail.com
Fri Apr 18 07:54:51 PDT 2014


Author: d0k
Date: Fri Apr 18 09:54:51 2014
New Revision: 206612

URL: http://llvm.org/viewvc/llvm-project?rev=206612&view=rev
Log:
Allocator: Remove ReferenceAdder hack.

This was a workaround for compilers that had issues with reference
collapsing.

Modified:
    llvm/trunk/include/llvm/ADT/ScopedHashTable.h
    llvm/trunk/include/llvm/ADT/StringMap.h
    llvm/trunk/include/llvm/Support/Allocator.h

Modified: llvm/trunk/include/llvm/ADT/ScopedHashTable.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ScopedHashTable.h?rev=206612&r1=206611&r2=206612&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/ScopedHashTable.h (original)
+++ llvm/trunk/include/llvm/ADT/ScopedHashTable.h Fri Apr 18 09:54:51 2014
@@ -167,10 +167,8 @@ public:
   
 
   /// Access to the allocator.
-  typedef typename ReferenceAdder<AllocatorTy>::result AllocatorRefTy;
-  typedef typename ReferenceAdder<const AllocatorTy>::result AllocatorCRefTy;
-  AllocatorRefTy getAllocator() { return Allocator; }
-  AllocatorCRefTy getAllocator() const { return Allocator; }
+  AllocatorTy &getAllocator() { return Allocator; }
+  const AllocatorTy &getAllocator() const { return Allocator; }
 
   bool count(const K &Key) const {
     return TopLevelMap.count(Key);

Modified: llvm/trunk/include/llvm/ADT/StringMap.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringMap.h?rev=206612&r1=206611&r2=206612&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/StringMap.h (original)
+++ llvm/trunk/include/llvm/ADT/StringMap.h Fri Apr 18 09:54:51 2014
@@ -246,10 +246,8 @@ public:
     clear();
   }
 
-  typedef typename ReferenceAdder<AllocatorTy>::result AllocatorRefTy;
-  typedef typename ReferenceAdder<const AllocatorTy>::result AllocatorCRefTy;
-  AllocatorRefTy getAllocator() { return Allocator; }
-  AllocatorCRefTy getAllocator() const { return Allocator; }
+  AllocatorTy &getAllocator() { return Allocator; }
+  const AllocatorTy &getAllocator() const { return Allocator; }
 
   typedef const char* key_type;
   typedef ValueTy mapped_type;

Modified: llvm/trunk/include/llvm/Support/Allocator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Allocator.h?rev=206612&r1=206611&r2=206612&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Allocator.h (original)
+++ llvm/trunk/include/llvm/Support/Allocator.h Fri Apr 18 09:54:51 2014
@@ -32,12 +32,6 @@
 #include <cstdlib>
 
 namespace llvm {
-template <typename T> struct ReferenceAdder {
-  typedef T &result;
-};
-template <typename T> struct ReferenceAdder<T &> {
-  typedef T result;
-};
 
 /// \brief CRTP base class providing obvious overloads for the core \c
 /// Allocate() methods of LLVM-style allocators.





More information about the llvm-commits mailing list