Commit 0697da05 by Ben Clayton

Reactor: Add nullptr_t copy / assignment operators to Pointer<T>

Change-Id: I253abead4412eec7e72148c8680be04c64bd2148 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/34548Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarBen Clayton <bclayton@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
parent 204a410c
......@@ -2325,10 +2325,12 @@ namespace rr
Pointer(RValue<Pointer<T>> rhs);
Pointer(const Pointer<T> &rhs);
Pointer(const Reference<Pointer<T>> &rhs);
Pointer(std::nullptr_t);
RValue<Pointer<T>> operator=(RValue<Pointer<T>> rhs);
RValue<Pointer<T>> operator=(const Pointer<T> &rhs);
RValue<Pointer<T>> operator=(const Reference<Pointer<T>> &rhs);
RValue<Pointer<T>> operator=(std::nullptr_t);
Reference<T> operator*();
Reference<T> operator[](int index);
......@@ -2842,6 +2844,13 @@ namespace rr
}
template<class T>
Pointer<T>::Pointer(std::nullptr_t) : alignment(1)
{
Value *value = Nucleus::createNullPointer(T::getType());
LValue<Pointer<T>>::storeValue(value);
}
template<class T>
RValue<Pointer<T>> Pointer<T>::operator=(RValue<Pointer<T>> rhs)
{
LValue<Pointer<T>>::storeValue(rhs.value);
......@@ -2868,6 +2877,15 @@ namespace rr
}
template<class T>
RValue<Pointer<T>> Pointer<T>::operator=(std::nullptr_t)
{
Value *value = Nucleus::createNullPointer(T::getType());
LValue<Pointer<T>>::storeValue(value);
return RValue<Pointer<T>>(this);
}
template<class T>
Reference<T> Pointer<T>::operator*()
{
return Reference<T>(LValue<Pointer<T>>::loadValue(), alignment);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment