scchan created this revision.
scchan added a reviewer: yaxunl.
scchan requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Add runtime functions to detect invalid calls to pure or deleted virtual
functions
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D104392
Files:
clang/lib/Headers/__clang_hip_runtime_wrapper.h
Index: clang/lib/Headers/__clang_hip_runtime_wrapper.h
===================================================================
--- clang/lib/Headers/__clang_hip_runtime_wrapper.h
+++ clang/lib/Headers/__clang_hip_runtime_wrapper.h
@@ -51,6 +51,23 @@
#define nullptr NULL;
#endif
+#ifdef __cplusplus
+extern "C" {
+ __attribute__((__visibility__("default")))
+ __attribute__((weak))
+ __attribute__((noreturn))
+ __device__ void __cxa_pure_virtual(void) {
+ __builtin_trap();
+ }
+ __attribute__((__visibility__("default")))
+ __attribute__((weak))
+ __attribute__((noreturn))
+ __device__ void __cxa_deleted_virtual(void) {
+ __builtin_trap();
+ }
+}
+#endif //__cplusplus
+
#if __HIP_ENABLE_DEVICE_MALLOC__
extern "C" __device__ void *__hip_malloc(size_t __size);
extern "C" __device__ void *__hip_free(void *__ptr);
Index: clang/lib/Headers/__clang_hip_runtime_wrapper.h
===================================================================
--- clang/lib/Headers/__clang_hip_runtime_wrapper.h
+++ clang/lib/Headers/__clang_hip_runtime_wrapper.h
@@ -51,6 +51,23 @@
#define nullptr NULL;
#endif
+#ifdef __cplusplus
+extern "C" {
+ __attribute__((__visibility__("default")))
+ __attribute__((weak))
+ __attribute__((noreturn))
+ __device__ void __cxa_pure_virtual(void) {
+ __builtin_trap();
+ }
+ __attribute__((__visibility__("default")))
+ __attribute__((weak))
+ __attribute__((noreturn))
+ __device__ void __cxa_deleted_virtual(void) {
+ __builtin_trap();
+ }
+}
+#endif //__cplusplus
+
#if __HIP_ENABLE_DEVICE_MALLOC__
extern "C" __device__ void *__hip_malloc(size_t __size);
extern "C" __device__ void *__hip_free(void *__ptr);
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits