Author: fineg74
Date: 2026-03-20T13:11:37+01:00
New Revision: bdc8d9293d28b2993526eae9f2398a3cef556735

URL: 
https://github.com/llvm/llvm-project/commit/bdc8d9293d28b2993526eae9f2398a3cef556735
DIFF: 
https://github.com/llvm/llvm-project/commit/bdc8d9293d28b2993526eae9f2398a3cef556735.diff

LOG: [OFFLOAD] Add GPU wrappers for headers currently supported by SPIRV built 
libc (#181913)

This is to add GPU wrappers for headers that are currently supported by
libc built for SPIRV.

Added: 
    

Modified: 
    clang/lib/Headers/llvm_libc_wrappers/ctype.h
    clang/lib/Headers/llvm_libc_wrappers/string.h

Removed: 
    


################################################################################
diff  --git a/clang/lib/Headers/llvm_libc_wrappers/ctype.h 
b/clang/lib/Headers/llvm_libc_wrappers/ctype.h
index 79b0c1e9be953..8d7bb608d4c5b 100644
--- a/clang/lib/Headers/llvm_libc_wrappers/ctype.h
+++ b/clang/lib/Headers/llvm_libc_wrappers/ctype.h
@@ -9,13 +9,14 @@
 #ifndef __CLANG_LLVM_LIBC_WRAPPERS_CTYPE_H__
 #define __CLANG_LLVM_LIBC_WRAPPERS_CTYPE_H__
 
-#if !defined(_OPENMP) && !defined(__HIP__) && !defined(__CUDA__)
+#if !defined(_OPENMP) && !defined(__HIP__) && !defined(__CUDA__) &&            
\
+    !defined(__SPIRV__)
 #error "This file is for GPU offloading compilation only"
 #endif
 
 #include_next <ctype.h>
 
-#if defined(__HIP__) || defined(__CUDA__)
+#if defined(__HIP__) || defined(__CUDA__) || defined(__SPIRV__)
 #define __LIBC_ATTRS __attribute__((device))
 #else
 #define __LIBC_ATTRS

diff  --git a/clang/lib/Headers/llvm_libc_wrappers/string.h 
b/clang/lib/Headers/llvm_libc_wrappers/string.h
index 766a58f5b6db4..5edb86ac9d520 100644
--- a/clang/lib/Headers/llvm_libc_wrappers/string.h
+++ b/clang/lib/Headers/llvm_libc_wrappers/string.h
@@ -9,13 +9,14 @@
 #ifndef __CLANG_LLVM_LIBC_WRAPPERS_STRING_H__
 #define __CLANG_LLVM_LIBC_WRAPPERS_STRING_H__
 
-#if !defined(_OPENMP) && !defined(__HIP__) && !defined(__CUDA__)
+#if !defined(_OPENMP) && !defined(__HIP__) && !defined(__CUDA__) &&            
\
+    !defined(__SPIRV__)
 #error "This file is for GPU offloading compilation only"
 #endif
 
 #include_next <string.h>
 
-#if defined(__HIP__) || defined(__CUDA__)
+#if defined(__HIP__) || defined(__CUDA__) || defined(__SPIRV__)
 #define __LIBC_ATTRS __attribute__((device))
 #else
 #define __LIBC_ATTRS


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to