llvm.org GIT mirror llvm / cef3925
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 Chris Lattner 8 years ago
1 changed file(s) with 5 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
2424 /// pointee object can be taken away from OwningPtr by using the take method.
2525 template
2626 class OwningPtr {
27 OwningPtr(OwningPtr const &); // DO NOT IMPLEMENT
28 OwningPtr &operator=(OwningPtr const &); // DO NOT IMPLEMENT
27 OwningPtr &operator=(const OwningPtr &); // DO NOT IMPLEMENT
2928 T *Ptr;
3029 public:
3130 explicit OwningPtr(T *P = 0) : Ptr(P) {}
31
32 OwningPtr(const OwningPtr &RHS) : Ptr(0) {
33 assert(RHS.Ptr == 0 && "Only null OwningPtr's are copyable!");
34 }
3235
3336 ~OwningPtr() {
3437 delete Ptr;