Internals: Add VNUser::toPtr(). No functional change is intended.

This commit is contained in:
Yutetsu TAKATSUKASA 2021-01-17 13:55:47 +09:00
parent e1404f0f16
commit f98dce10db

View File

@ -1136,10 +1136,11 @@ public:
explicit VNUser(void* p) { m_u.up = p; }
~VNUser() = default;
// Casters
WidthVP* c() const { return reinterpret_cast<WidthVP*>(m_u.up); }
VSymEnt* toSymEnt() const { return reinterpret_cast<VSymEnt*>(m_u.up); }
AstNode* toNodep() const { return reinterpret_cast<AstNode*>(m_u.up); }
V3GraphVertex* toGraphVertex() const { return reinterpret_cast<V3GraphVertex*>(m_u.up); }
template <typename T> T* toPtr() const { return reinterpret_cast<T*>(m_u.up); }
WidthVP* c() const { return toPtr<WidthVP>(); }
VSymEnt* toSymEnt() const { return toPtr<VSymEnt>(); }
AstNode* toNodep() const { return toPtr<AstNode>(); }
V3GraphVertex* toGraphVertex() const { return toPtr<V3GraphVertex>(); }
int toInt() const { return m_u.ui; }
static VNUser fromInt(int i) { return VNUser(i); }
};