[Openmp-commits] [PATCH] D96667: [OpenMP][FIX] Avoid use of stack allocations in asynchronous calls

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Sun Feb 14 13:04:14 PST 2021


tianshilei1992 added inline comments.


================
Comment at: openmp/libomptarget/include/omptarget.h:162
+  /// AsyncInfoTy object. The location can be used as intermediate buffer.
+  void *&getVoidPtrLocation();
 };
----------------
I'd go with a more generic method:
```
std::vector<std::unique_ptr<char[]>> BufferLocations;
template <typename T>
T *getPtr() {
  BufferLocations.emplace_back(std::make_unique<char[]>(sizeof(T)));
  return reinterpret_cast<T *>(BufferLocations.back().get());
}
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96667/new/

https://reviews.llvm.org/D96667



More information about the Openmp-commits mailing list