OpaquePtr: Provide conversion-from-nullptr_t to make default construction simpler to read/write

llvm-svn: 257955
This commit is contained in:
David Blaikie 2016-01-15 23:43:21 +00:00
parent 78f7907953
commit 62d4a253f7
1 changed files with 2 additions and 2 deletions

View File

@ -43,13 +43,13 @@ namespace clang {
/// compatible with "Type" pointers for example. /// compatible with "Type" pointers for example.
template <class PtrTy> template <class PtrTy>
class OpaquePtr { class OpaquePtr {
void *Ptr; void *Ptr = nullptr;
explicit OpaquePtr(void *Ptr) : Ptr(Ptr) {} explicit OpaquePtr(void *Ptr) : Ptr(Ptr) {}
typedef llvm::PointerLikeTypeTraits<PtrTy> Traits; typedef llvm::PointerLikeTypeTraits<PtrTy> Traits;
public: public:
OpaquePtr() : Ptr(nullptr) {} OpaquePtr(std::nullptr_t = nullptr) {}
static OpaquePtr make(PtrTy P) { OpaquePtr OP; OP.set(P); return OP; } static OpaquePtr make(PtrTy P) { OpaquePtr OP; OP.set(P); return OP; }