diff options
author | Chris Lattner <sabre@nondot.org> | 2012-01-23 08:19:57 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2012-01-23 08:19:57 +0000 |
commit | cef39256986150d6e7d6d87ea36077452f045c50 (patch) | |
tree | 3f7491db8a5b3bb453bc05692845d0eeb2837acf /include | |
parent | 7925e2555d4a2305784365176dba72a64fc3975c (diff) | |
download | external_llvm-cef39256986150d6e7d6d87ea36077452f045c50.zip external_llvm-cef39256986150d6e7d6d87ea36077452f045c50.tar.gz external_llvm-cef39256986150d6e7d6d87ea36077452f045c50.tar.bz2 |
allow OwningPtr to be copy constructed if null, which is required to
make them be a valuetype in a DenseMap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148688 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/ADT/OwningPtr.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/include/llvm/ADT/OwningPtr.h b/include/llvm/ADT/OwningPtr.h index 6d9c305..e82ebc7 100644 --- a/include/llvm/ADT/OwningPtr.h +++ b/include/llvm/ADT/OwningPtr.h @@ -25,12 +25,15 @@ namespace llvm { /// pointee object can be taken away from OwningPtr by using the take method. template<class T> class OwningPtr { - OwningPtr(OwningPtr const &); // DO NOT IMPLEMENT - OwningPtr &operator=(OwningPtr const &); // DO NOT IMPLEMENT + OwningPtr &operator=(const OwningPtr &); // DO NOT IMPLEMENT T *Ptr; public: explicit OwningPtr(T *P = 0) : Ptr(P) {} + OwningPtr(const OwningPtr &RHS) : Ptr(0) { + assert(RHS.Ptr == 0 && "Only null OwningPtr's are copyable!"); + } + ~OwningPtr() { delete Ptr; } |