Commit 0953d9ba by Ben Clayton

Reactor: Add self() method to LValue<T> and Array<T>

As LValue<T> overloads operator&(), there's no sensible way to get the address of the reactor type. This is handy for storing a pointer to an Array or LValue in a field. Bug: b/133213304 Change-Id: I950ee312005bc57187129f009578b8715973804a Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/33357Tested-by: 's avatarBen Clayton <bclayton@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 34c59c9b
...@@ -157,6 +157,10 @@ namespace rr ...@@ -157,6 +157,10 @@ namespace rr
{ {
return false; return false;
} }
// self() returns the this pointer to this LValue<T> object.
// This function exists because operator&() is overloaded.
inline LValue<T>* self() { return this; }
}; };
template<class T> template<class T>
...@@ -2448,6 +2452,10 @@ namespace rr ...@@ -2448,6 +2452,10 @@ namespace rr
Reference<T> operator[](unsigned int index); Reference<T> operator[](unsigned int index);
Reference<T> operator[](RValue<Int> index); Reference<T> operator[](RValue<Int> index);
Reference<T> operator[](RValue<UInt> index); Reference<T> operator[](RValue<UInt> index);
// self() returns the this pointer to this Array object.
// This function exists because operator&() is overloaded by LValue<T>.
inline Array* self() { return this; }
}; };
// RValue<Array<T>> operator++(Array<T> &val, int); // Post-increment // RValue<Array<T>> operator++(Array<T> &val, int); // Post-increment
......
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