Skip to content

Commit 7627f88

Browse files
committed
Use try/catch instead
1 parent 371c628 commit 7627f88

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

sycl/source/detail/device_global_map.hpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,14 @@ class DeviceGlobalMap {
3030
DeviceGlobalMap(const DeviceGlobalMap &) = delete;
3131
DeviceGlobalMap &operator=(const DeviceGlobalMap &) = delete;
3232

33-
~DeviceGlobalMap() noexcept(false) {
34-
if (!MOwnerControlledCleanup)
35-
for (auto &DeviceGlobalIt : MDeviceGlobals)
36-
DeviceGlobalIt.second->cleanup();
33+
~DeviceGlobalMap() {
34+
try {
35+
if (!MOwnerControlledCleanup)
36+
for (auto &DeviceGlobalIt : MDeviceGlobals)
37+
DeviceGlobalIt.second->cleanup();
38+
} catch (std::exception &e) {
39+
__SYCL_REPORT_EXCEPTION_TO_STREAM("exception in ~DeviceGlobalMap", e);
40+
}
3741
}
3842

3943
void initializeEntries(const RTDeviceBinaryImage *Img) {

0 commit comments

Comments
 (0)