Define TVM_FFI_S_VISIT_MAYBE_EARLY_RETURN#
Defined in File structural_visit.h
Define Documentation#
-
TVM_FFI_S_VISIT_MAYBE_EARLY_RETURN(Result)#
Return from a visit hook if
Resultstops traversal.Propagates an
Erroror aVisitInterruptout of the enclosing function and otherwise falls through. AnOptional<VisitInterrupt>result is returned directly. AnExpectedresult uses an rvalue-only proxy to select the return representation for rawTVMFFIAnyhooks or typedExpectedhelpers.A registered
__s_visit__hook is one line per traversed field followed by the terminal return. A field skipped on purpose is guarded by a condition and carries a// skips:note saying why.TVMFFIAny FooVisit(StructuralVisitorObj* visitor, AnyView value) noexcept { const FooNode* self = details::AnyUnsafe::RawObjectPtrFromAnyViewAfterCheck<const FooNode>(value); TVM_FFI_S_VISIT_MAYBE_EARLY_RETURN(visitor->VisitExpected(self->a)); TVM_FFI_S_VISIT_MAYBE_EARLY_RETURN(visitor->VisitExpected(self->b)); return AnyView(nullptr).CopyToTVMFFIAny(); }
- Parameters:
Result – An expression yielding the descent result to inspect.