summaryrefslogtreecommitdiff
path: root/include/llvm/ADT/StringMap.h
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2014-05-08 21:52:26 +0000
committerDavid Blaikie <dblaikie@gmail.com>2014-05-08 21:52:26 +0000
commit06eb84e21abe8771d6de22f64778663b853716d9 (patch)
tree7ab306391a76300fb2f8d8fe8424b501f6b07a01 /include/llvm/ADT/StringMap.h
parentb0439e6d6a7c3cd93589b712b732334803506184 (diff)
downloadllvm-06eb84e21abe8771d6de22f64778663b853716d9.tar.gz
llvm-06eb84e21abe8771d6de22f64778663b853716d9.tar.bz2
llvm-06eb84e21abe8771d6de22f64778663b853716d9.tar.xz
StringMap: Replace faux-copyability with faux-movability, which is sufficient.
This behavior was added to support StringMaps of StringMaps, default + move construction are sufficient for this. Real move construction support coming soon (& probably copy construction too). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208360 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT/StringMap.h')
-rw-r--r--include/llvm/ADT/StringMap.h30
1 files changed, 14 insertions, 16 deletions
diff --git a/include/llvm/ADT/StringMap.h b/include/llvm/ADT/StringMap.h
index 3a0006f5a1..ed3685d7dd 100644
--- a/include/llvm/ADT/StringMap.h
+++ b/include/llvm/ADT/StringMap.h
@@ -17,6 +17,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Allocator.h"
#include <cstring>
+#include <utility>
namespace llvm {
template<typename ValueT>
@@ -48,13 +49,11 @@ protected:
unsigned NumTombstones;
unsigned ItemSize;
protected:
- explicit StringMapImpl(unsigned itemSize) : ItemSize(itemSize) {
- // Initialize the map with zero buckets to allocation.
- TheTable = nullptr;
- NumBuckets = 0;
- NumItems = 0;
- NumTombstones = 0;
- }
+ explicit StringMapImpl(unsigned itemSize)
+ : TheTable(nullptr),
+ // Initialize the map with zero buckets to allocation.
+ NumBuckets(0), NumItems(0), NumTombstones(0), ItemSize(itemSize) {}
+
StringMapImpl(unsigned InitSize, unsigned ItemSize);
void RehashTable();
@@ -233,18 +232,17 @@ public:
: StringMapImpl(InitialSize, static_cast<unsigned>(sizeof(MapEntryTy))),
Allocator(A) {}
- StringMap(const StringMap &RHS)
- : StringMapImpl(static_cast<unsigned>(sizeof(MapEntryTy))) {
- assert(RHS.empty() &&
- "Copy ctor from non-empty stringmap not implemented yet!");
- (void)RHS;
+ StringMap(StringMap &&RHS)
+ : StringMapImpl(static_cast<unsigned>(sizeof(MapEntryTy))) {
+ assert(RHS.empty());
}
- void operator=(const StringMap &RHS) {
- assert(RHS.empty() &&
- "assignment from non-empty stringmap not implemented yet!");
- (void)RHS;
+ StringMap &operator=(StringMap &&RHS) {
+ assert(RHS.empty());
clear();
+ return *this;
}
+ StringMap(const StringMap &RHS) LLVM_DELETED_FUNCTION;
+ void operator=(const StringMap &RHS) LLVM_DELETED_FUNCTION;
AllocatorTy &getAllocator() { return Allocator; }
const AllocatorTy &getAllocator() const { return Allocator; }