#ifndef LLVM_ADT_INTRUSIVEREFCNTPTR_H
#define LLVM_ADT_INTRUSIVEREFCNTPTR_H
-#include "llvm/Support/Casting.h"
-#include "llvm/Support/Compiler.h"
#include <atomic>
-#include <memory>
+#include <cassert>
+#include <cstddef>
namespace llvm {
friend struct IntrusiveRefCntPtrInfo;
};
-
+
template <typename T> struct IntrusiveRefCntPtrInfo {
static void retain(T *obj) { obj->Retain(); }
static void release(T *obj) { obj->Release(); }
delete static_cast<const Derived*>(this);
}
};
-
+
//===----------------------------------------------------------------------===//
/// IntrusiveRefCntPtr - A template class that implements a "smart pointer"
/// that assumes the wrapped object has a reference count associated
template <class X>
IntrusiveRefCntPtr(IntrusiveRefCntPtr<X>&& S) : Obj(S.get()) {
- S.Obj = 0;
+ S.Obj = nullptr;
}
template <class X>
T* get() const { return Obj; }
- /// Deprecated: use get().
- T* getPtr() const { return Obj; }
-
- LLVM_EXPLICIT operator bool() const { return Obj; }
+ explicit operator bool() const { return Obj; }
void swap(IntrusiveRefCntPtr& other) {
T* tmp = other.Obj;
}
void resetWithoutRelease() {
- Obj = 0;
+ Obj = nullptr;
}
private:
void retain() { if (Obj) IntrusiveRefCntPtrInfo<T>::retain(Obj); }
void release() { if (Obj) IntrusiveRefCntPtrInfo<T>::release(Obj); }
+
+ template <typename X>
+ friend class IntrusiveRefCntPtr;
};
template<class T, class U>
// LLVM-style downcasting support for IntrusiveRefCntPtr objects
//===----------------------------------------------------------------------===//
+ template <typename From> struct simplify_type;
+
template<class T> struct simplify_type<IntrusiveRefCntPtr<T> > {
typedef T* SimpleType;
static SimpleType getSimplifiedValue(IntrusiveRefCntPtr<T>& Val) {