diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2012-05-19 13:28:54 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2012-05-19 13:28:54 +0000 |
commit | ac5802bca0285eee49c1c372846552823d819181 (patch) | |
tree | d5b9dd4e328d40f8a9a1c43ae117c7a6c4e79103 /include/llvm/ADT/TinyPtrVector.h | |
parent | f4c261b1378b0f7aaede3a791f0e05c9ab94ea34 (diff) | |
download | external_llvm-ac5802bca0285eee49c1c372846552823d819181.zip external_llvm-ac5802bca0285eee49c1c372846552823d819181.tar.gz external_llvm-ac5802bca0285eee49c1c372846552823d819181.tar.bz2 |
Provide move semantics for TinyPtrVector and for DenseMap's rehash function.
This makes DenseMap<..., TinyPtrVector<...>> as cheap as it always should've been!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157113 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT/TinyPtrVector.h')
-rw-r--r-- | include/llvm/ADT/TinyPtrVector.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/llvm/ADT/TinyPtrVector.h b/include/llvm/ADT/TinyPtrVector.h index 5014517..f9b7d55 100644 --- a/include/llvm/ADT/TinyPtrVector.h +++ b/include/llvm/ADT/TinyPtrVector.h @@ -10,8 +10,10 @@ #ifndef LLVM_ADT_TINYPTRVECTOR_H #define LLVM_ADT_TINYPTRVECTOR_H +#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/PointerUnion.h" +#include "llvm/Support/Compiler.h" namespace llvm { @@ -32,6 +34,11 @@ public: if (VecTy *V = Val.template dyn_cast<VecTy*>()) Val = new VecTy(*V); } +#if LLVM_USE_RVALUE_REFERENCES + TinyPtrVector(TinyPtrVector &&RHS) : Val(RHS.Val) { + RHS.Val = (EltTy)0; + } +#endif ~TinyPtrVector() { if (VecTy *V = Val.template dyn_cast<VecTy*>()) delete V; @@ -159,6 +166,9 @@ public: private: void operator=(const TinyPtrVector&); // NOT IMPLEMENTED YET. +#if LLVM_USE_RVALUE_REFERENCES + void operator=(TinyPtrVector&&); // NOT IMPLEMENTED YET. +#endif }; } // end namespace llvm |