diff options
author | Joseph Huber <jhuber6@vols.utk.edu> | 2023-03-20 11:49:10 -0500 |
---|---|---|
committer | Joseph Huber <jhuber6@vols.utk.edu> | 2023-03-20 11:49:59 -0500 |
commit | edc03550063ce1c39bb47bf94937cf036359b487 (patch) | |
tree | 03de8e6f41fbb49248b5878dfd077099e45663de /openmp | |
parent | 67089a39a23b6ff4d1e2c16502cdf627cb56e6fc (diff) | |
download | llvm-edc03550063ce1c39bb47bf94937cf036359b487.tar.gz |
[Libomptarget] Add missing explicit moves on llvm::Error
Summary:
Some older compilers, which we still support, have problems handling the
copy elision that allows us to directly move an `Error` to an
`Expected`. This patch adds explicit moves to remove the error.
Diffstat (limited to 'openmp')
-rw-r--r-- | openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp | 2 | ||||
-rw-r--r-- | openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp b/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp index e03825651286..5a31c5362265 100644 --- a/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp +++ b/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp @@ -1863,7 +1863,7 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy { hsa_status_t Status = hsa_amd_memory_lock(HstPtr, Size, nullptr, 0, &PinnedPtr); if (auto Err = Plugin::check(Status, "Error in hsa_amd_memory_lock: %s\n")) - return Err; + return std::move(Err); return PinnedPtr; } diff --git a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp index 65983577f08f..0b90d250b762 100644 --- a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp +++ b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp @@ -703,7 +703,7 @@ Expected<void *> PinnedAllocationMapTy::lockHostBuffer(void *HstPtr, if (Entry) { // An already registered intersecting buffer was found. Register a new use. if (auto Err = registerEntryUse(*Entry, HstPtr, Size)) - return Err; + return std::move(Err); // Return the device accessible pointer with the correct offset. return advanceVoidPtr(Entry->DevAccessiblePtr, @@ -718,7 +718,7 @@ Expected<void *> PinnedAllocationMapTy::lockHostBuffer(void *HstPtr, // Now insert the new entry into the map. if (auto Err = insertEntry(HstPtr, *DevAccessiblePtrOrErr, Size)) - return Err; + return std::move(Err); // Return the device accessible pointer. return *DevAccessiblePtrOrErr; @@ -885,7 +885,7 @@ Expected<void *> GenericDeviceTy::dataAlloc(int64_t Size, void *HostPtr, // Register allocated buffer as pinned memory if the type is host memory. if (Kind == TARGET_ALLOC_HOST) if (auto Err = PinnedAllocs.registerHostBuffer(Alloc, Alloc, Size)) - return Err; + return std::move(Err); return Alloc; } |