[Openmp-commits] [openmp] 4d3f79f - [OpenMP] Resolve const cast issue introduced in D123446
Johannes Doerfert via Openmp-commits
openmp-commits at lists.llvm.org
Mon Mar 27 22:14:22 PDT 2023
Author: Johannes Doerfert
Date: 2023-03-27T22:13:38-07:00
New Revision: 4d3f79f2ad75cf7c366d27466cfced41c395adf9
URL: https://github.com/llvm/llvm-project/commit/4d3f79f2ad75cf7c366d27466cfced41c395adf9
DIFF: https://github.com/llvm/llvm-project/commit/4d3f79f2ad75cf7c366d27466cfced41c395adf9.diff
LOG: [OpenMP] Resolve const cast issue introduced in D123446
Added:
Modified:
openmp/libomptarget/include/device.h
openmp/libomptarget/src/omptarget.cpp
Removed:
################################################################################
diff --git a/openmp/libomptarget/include/device.h b/openmp/libomptarget/include/device.h
index 695f864b5ec6..5f147f9c77e6 100644
--- a/openmp/libomptarget/include/device.h
+++ b/openmp/libomptarget/include/device.h
@@ -251,7 +251,7 @@ struct HostDataToTargetTy {
/// OFFLOAD_SUCCESS. The entry is locked for this operation.
template <typename CBTy> int foreachShadowPointerInfo(CBTy CB) const {
for (auto &It : States->ShadowPtrInfos)
- if (CB(It) == OFFLOAD_FAIL)
+ if (CB(const_cast<ShadowPtrInfoTy &>(It)) == OFFLOAD_FAIL)
return OFFLOAD_FAIL;
return OFFLOAD_SUCCESS;
}
diff --git a/openmp/libomptarget/src/omptarget.cpp b/openmp/libomptarget/src/omptarget.cpp
index 9df1d3637fde..0459648a4802 100644
--- a/openmp/libomptarget/src/omptarget.cpp
+++ b/openmp/libomptarget/src/omptarget.cpp
@@ -1038,7 +1038,7 @@ static int targetDataContiguous(ident_t *Loc, DeviceTy &Device, void *ArgsBase,
}
if (TPR.getEntry()) {
int Ret = TPR.getEntry()->foreachShadowPointerInfo(
- [&](const ShadowPtrInfoTy &ShadowPtr) {
+ [&](ShadowPtrInfoTy &ShadowPtr) {
DP("Restoring original target pointer value " DPxMOD " for target "
"pointer " DPxMOD "\n",
DPxPTR(ShadowPtr.TgtPtrVal), DPxPTR(ShadowPtr.TgtPtrAddr));
More information about the Openmp-commits
mailing list