Commit b4e4f11f by Nicolas Capens Committed by Nicolas Capens

Add type-safe Reference<T> load method

This methods returns an RValue<T> type so it's safer than 'loadValue()'. Bug: b/155302798 Change-Id: Ib48819bd0a1b64ae2d22eda4910ad0b551b1eed7 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/44670 Kokoro-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarAntonio Maiorano <amaiorano@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 5f77c5e5
......@@ -183,6 +183,7 @@ public:
RValue<Pointer<T>> operator&() const { return RValue<Pointer<T>>(address); }
Value *loadValue() const;
RValue<T> load() const;
int getAlignment() const;
private:
......@@ -2715,6 +2716,12 @@ Value *Reference<T>::loadValue() const
}
template<class T>
RValue<T> Reference<T>::load() const
{
return RValue<T>(loadValue());
}
template<class T>
int Reference<T>::getAlignment() const
{
return 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