[PATCH] D23239: [CUDA] Add __device__ overloads for placement new and delete.

Justin Lebar via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 9 18:17:15 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL278194: [CUDA] Add __device__ overloads for placement new and delete. (authored by jlebar).

Changed prior to commit:
  https://reviews.llvm.org/D23239?vs=67282&id=67447#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23239

Files:
  cfe/trunk/lib/Headers/__clang_cuda_runtime_wrapper.h

Index: cfe/trunk/lib/Headers/__clang_cuda_runtime_wrapper.h
===================================================================
--- cfe/trunk/lib/Headers/__clang_cuda_runtime_wrapper.h
+++ cfe/trunk/lib/Headers/__clang_cuda_runtime_wrapper.h
@@ -312,5 +312,23 @@
 #pragma pop_macro("uint3")
 #pragma pop_macro("__USE_FAST_MATH__")
 
+// Device overrides for placement new and delete.
+#pragma push_macro("CUDA_NOEXCEPT")
+#if __cplusplus >= 201103L
+#define CUDA_NOEXCEPT noexcept
+#else
+#define CUDA_NOEXCEPT
+#endif
+
+__device__ inline void *operator new(__SIZE_TYPE__, void *__ptr) CUDA_NOEXCEPT {
+  return __ptr;
+}
+__device__ inline void *operator new[](__SIZE_TYPE__, void *__ptr) CUDA_NOEXCEPT {
+  return __ptr;
+}
+__device__ inline void operator delete(void *, void *) CUDA_NOEXCEPT {}
+__device__ inline void operator delete[](void *, void *) CUDA_NOEXCEPT {}
+#pragma pop_macro("CUDA_NOEXCEPT")
+
 #endif // __CUDA__
 #endif // __CLANG_CUDA_RUNTIME_WRAPPER_H__


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23239.67447.patch
Type: text/x-patch
Size: 977 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160810/4ef1d290/attachment.bin>


More information about the cfe-commits mailing list