Skip to content

Commit fa6f822

Browse files
gasoonjiafacebook-github-bot
gasoonjia
authored andcommitted
use kUnsetDebugHandle for unset debug handle in etdump delegation log
Differential Revision: D72095995
1 parent 7d35c68 commit fa6f822

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

devtools/etdump/etdump_flatcc.cpp

+14-1
Original file line numberDiff line numberDiff 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();

0 commit comments

Comments
 (0)