Skip to content

Commit af71862

Browse files
[NFC][SYCL][XPTI] Fix minor coverity hits (intel#20032)
This is a cherry-pick of intel#19952 Patch-by: Udit Kumar Agarwal <[email protected]>
1 parent f2bab60 commit af71862

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

sycl/source/detail/device_global_map.hpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,17 @@ class DeviceGlobalMap {
2727
DeviceGlobalMap(bool OwnerControlledCleanup)
2828
: MOwnerControlledCleanup{OwnerControlledCleanup} {}
2929

30+
DeviceGlobalMap(const DeviceGlobalMap &) = delete;
31+
DeviceGlobalMap &operator=(const DeviceGlobalMap &) = delete;
32+
3033
~DeviceGlobalMap() {
31-
if (!MOwnerControlledCleanup)
32-
for (auto &DeviceGlobalIt : MDeviceGlobals)
33-
DeviceGlobalIt.second->cleanup();
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+
}
3441
}
3542

3643
void initializeEntries(const RTDeviceBinaryImage *Img) {

sycl/source/detail/device_global_map_entry.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ struct DeviceGlobalMapEntry {
6767
// Constructor for only initializing ID and pointer. The other members will
6868
// be initialized later.
6969
DeviceGlobalMapEntry(std::string UniqueId, const void *DeviceGlobalPtr)
70-
: MUniqueId(UniqueId), MDeviceGlobalPtr(DeviceGlobalPtr) {}
70+
: MUniqueId(std::move(UniqueId)), MDeviceGlobalPtr(DeviceGlobalPtr) {}
7171

7272
// Constructor for only initializing ID, type size, and device image scope
7373
// flag. The pointer to the device global will be initialized later.
7474
DeviceGlobalMapEntry(std::string UniqueId, const RTDeviceBinaryImage *Img,
7575
std::uint32_t DeviceGlobalTSize,
7676
bool IsDeviceImageScopeDecorated)
77-
: MUniqueId(UniqueId), MImages{Img},
77+
: MUniqueId(std::move(UniqueId)), MImages{Img},
7878
MImageIdentifiers{reinterpret_cast<uintptr_t>(Img)},
7979
MDeviceGlobalTSize(DeviceGlobalTSize),
8080
MIsDeviceImageScopeDecorated(IsDeviceImageScopeDecorated) {}

sycl/source/detail/property_set_io.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ static IntT stringViewToInt(const std::string_view &SV) {
3030
if (SV.empty())
3131
return Result;
3232

33-
bool Negate = std::is_signed_v<IntT> && SV[0] == '-';
33+
const bool Negate = std::is_signed_v<IntT> && SV[0] == '-';
3434

3535
for (size_t I = static_cast<size_t>(Negate); I < SV.size(); ++I) {
3636
const char CurrentC = SV[I];

xpti/include/xpti/xpti_trace_framework.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1731,6 +1731,7 @@ class tracepoint_t {
17311731
m_default_event_type = (uint16_t)xpti::trace_event_type_t::algorithm;
17321732
m_default_activity_type = xpti::trace_activity_type_t::active;
17331733
m_default_name = "Message"; // Likely never used
1734+
m_instID = 0;
17341735
}
17351736
/// The payload data structure that is prepared from code_location(),
17361737
/// caller_callee string or kernel name/codepointer based on the opt-in flag.

0 commit comments

Comments
 (0)