Skip to content

Commit 43e5dae

Browse files
committed
change to switch
1 parent 2f6ca9c commit 43e5dae

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

source/loader/layers/sanitizer/asan_interceptor.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -358,15 +358,17 @@ ur_result_t SanitizerInterceptor::postLaunchKernel(ur_kernel_handle_t Kernel,
358358
if (!AH.Flag) {
359359
continue;
360360
}
361-
if (AH.ErrorType == DeviceSanitizerErrorType::USE_AFTER_FREE) {
361+
switch (AH.ErrorType) {
362+
case DeviceSanitizerErrorType::USE_AFTER_FREE:
362363
ReportUseAfterFree(AH, Kernel, GetContext(Queue));
363-
} else if (AH.ErrorType ==
364-
DeviceSanitizerErrorType::OUT_OF_BOUNDS ||
365-
AH.ErrorType == DeviceSanitizerErrorType::MISALIGNED ||
366-
AH.ErrorType == DeviceSanitizerErrorType::NULL_POINTER) {
367-
ReportOutOfBoundsError(AH, Kernel);
368-
} else {
369-
ReportGenericError(AH);
364+
break;
365+
case DeviceSanitizerErrorType::OUT_OF_BOUNDS:
366+
case DeviceSanitizerErrorType::MISALIGNED:
367+
case DeviceSanitizerErrorType::NULL_POINTER:
368+
ReportGenericError(AH, Kernel);
369+
break;
370+
default:
371+
ReportFatalError(AH);
370372
}
371373
if (!AH.IsRecover) {
372374
exit(1);

0 commit comments

Comments
 (0)