tqchen commented on code in PR #670: URL: https://github.com/apache/tvm-ffi/pull/670#discussion_r3592163279
########## include/tvm/ffi/object.h: ########## @@ -546,6 +546,19 @@ inline constexpr bool is_qualified_object_v = } // namespace details +/*! + * \brief Mark a forward-declared type as an Object subclass. + * + * Invoke this macro at global namespace scope after forward declaring Type. + * Generated ABI headers use it so recursive container fields can instantiate + * ObjectPtr traits before the pointee type's definition is complete. + * + * \param Type The fully qualified Object subclass. + */ +#define TVM_FFI_DECLARE_OBJECT_SUBCLASS(Type) \ + template <> \ + inline constexpr bool tvm::ffi::details::is_object_subclass_v<Type> = true Review Comment: minor, given this is a general mechnanism like type_subsume_v we can keep it under tvm::ffi:: would be good to gave a testcase to confirm it helps recursive decl of ObjectPtr<T>. This macro is one liner and maybe worthwhile to just do the two liner as it is in places that need it -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
