diff --git a/include/verilated_types.h b/include/verilated_types.h index 271de4f67..ef0611ac9 100644 --- a/include/verilated_types.h +++ b/include/verilated_types.h @@ -1079,6 +1079,7 @@ public: //=================================================================== // Represents the null pointer. Used for setting VlClassRef to null instead of // via nullptr_t, to prevent the implicit conversion of 0 to nullptr. + struct VlNull { operator bool() const { return false; } }; @@ -1178,18 +1179,6 @@ public: operator bool() const { return m_objp; } }; -#define VL_NEW(Class, ...) \ - VlClassRef { vlSymsp->__Vm_deleter, __VA_ARGS__ } - -#define VL_KEEP_THIS \ - VlClassRef::type> __Vthisref { this } - -template // T typically of type VlClassRef -inline T VL_NULL_CHECK(T t, const char* filename, int linenum) { - if (VL_UNLIKELY(!t)) Verilated::nullPointerError(filename, linenum); - return t; -} - template static inline bool VL_CAST_DYNAMIC(VlClassRef in, VlClassRef& outr) { VlClassRef casted = in.template dynamicCast(); @@ -1203,4 +1192,18 @@ static inline bool VL_CAST_DYNAMIC(VlClassRef in, VlClassRef& outr) { //====================================================================== +#define VL_NEW(Class, ...) \ + VlClassRef { vlSymsp->__Vm_deleter, __VA_ARGS__ } + +#define VL_KEEP_THIS \ + VlClassRef::type> __Vthisref { this } + +template // T typically of type VlClassRef +inline T VL_NULL_CHECK(T t, const char* filename, int linenum) { + if (VL_UNLIKELY(!t)) Verilated::nullPointerError(filename, linenum); + return t; +} + +//====================================================================== + #endif // Guard