File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -352,8 +352,21 @@ void ETDumpGen::log_intermediate_output_delegate_helper(
352352 const char * name,
353353 DebugHandle delegate_debug_index,
354354 const T& output) {
355+ // Previously we compared delegate_debug_index to -1 to check if it is set,
356+ // but this is not a good solution because delegate_debug_index is of
357+ // DebugHandle type which is a uint32_t. Also we have a specific value for
358+ // runtime::kUnsetDebugHandle to represent an unset debug handle.
359+ //
360+ // To maintain backward compatibility:
361+ // 1. We keep the comparison with -1 (cast to DebugHandle)
362+ // 2. We add comparison with runtime::kUnsetDebugHandle
363+ //
364+ // TODO(gasoonjia): In the future, we should remove the comparison with -1 and
365+ // only compare with runtime::kUnsetDebugHandle.
355366 ET_CHECK_MSG (
356- (name == nullptr ) ^ (delegate_debug_index == -1 ),
367+ (name == nullptr ) ^
368+ (delegate_debug_index == runtime::kUnsetDebugHandle ||
369+ delegate_debug_index == static_cast <DebugHandle>(-1 )),
357370 " Only name or delegate_debug_index can be valid. Check DelegateMappingBuilder documentation for more details." );
358371
359372 check_ready_to_add_events ();
You can’t perform that action at this time.
0 commit comments