spir: Fix -Wcatch-value warnings (#1565)

`std::exception` and `std::runtime_error` are polymorphic types and as
such they shouldn't be passed by value.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
This commit is contained in:
Sven van Haastregt
2022-11-24 11:43:51 +00:00
committed by GitHub
parent c6bb15c289
commit e9d2abf705
2 changed files with 5 additions and 6 deletions

View File

@@ -6253,7 +6253,7 @@ static bool test_image_enumeration(cl_context context, cl_command_queue queue,
(FailE)(it.toString(), kernelName);
std::cout << "enum_" << it.toString() << " FAILED" << std::endl;
}
} catch(std::exception e)
} catch (const std::exception &e)
{
(FailE)(it.toString(), kernelName);
print_error(1, e.what());
@@ -6356,7 +6356,7 @@ static bool test_image_enumeration_3d(cl_context context, cl_command_queue queue
(FailE)(it.toString(), kernelName);
std::cout << "enum_" << it.toString() << " FAILED" << std::endl;
}
} catch(std::exception e)
} catch (const std::exception &e)
{
(FailE)(it.toString(), kernelName);
print_error(1, e.what());
@@ -6521,7 +6521,7 @@ test_kernel_attributes(cl_device_id device, cl_uint width, const char *folder)
}
(SuccE)(test_name, "");
log_info("kernel_attributes passed.\n");
} catch(std::exception e)
} catch (const std::exception &e)
{
(FailE)(test_name, "");
log_info("kernel_attributes FAILED\n");
@@ -6587,7 +6587,7 @@ static bool test_binary_type(cl_device_id device, cl_uint width, const char *fol
}
(SuccE)(test_name, "");
log_info("binary_type passed.\n");
} catch(std::exception e)
} catch (const std::exception &e)
{
(FailE)(test_name, "");
log_info("binary_type FAILED\n");

View File

@@ -462,8 +462,7 @@ bool TestRunner::runBuildTest(cl_device_id device, const char *folder,
log_info("kernel '%s' failed.\n", kernel_name.c_str());
(*m_failureHandler)(test_name, kernel_name);
}
}
catch (std::runtime_error err)
} catch (const std::runtime_error& err)
{
++failures;
log_info("kernel '%s' failed: %s\n", kernel_name.c_str(), err.what());