Author: Fraser Cormack
Date: 2025-01-15T10:14:51Z
New Revision: a5b88cb815d8f38698a3064a727b59143e0dae42

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

LOG: [libclc] Add missing includes to CLC headers (#118654)

There's no automatic way of checking these headers are self-contained.

Instead of including these common files many times across the whole
codebase, we can include them in the generic `gentype.inc` and
`floatn.inc` files which are included by most CLC headers.

Added: 
    libclc/clc/include/clc/geometric/floatn.inc

Modified: 
    libclc/clc/include/clc/integer/gentype.inc
    libclc/clc/include/clc/math/gentype.inc
    libclc/clc/include/clc/math/unary_intrin.inc
    libclc/clc/include/clc/relational/clc_all.h
    libclc/clc/include/clc/relational/clc_any.h
    libclc/clc/include/clc/relational/clc_isequal.h
    libclc/clc/include/clc/relational/clc_isinf.h
    libclc/clc/include/clc/relational/clc_isnan.h
    libclc/clc/include/clc/relational/floatn.inc
    libclc/clc/include/clc/shared/clc_clamp.h

Removed: 
    libclc/generic/include/clc/geometric/floatn.inc


################################################################################
diff  --git a/libclc/generic/include/clc/geometric/floatn.inc 
b/libclc/clc/include/clc/geometric/floatn.inc
similarity index 96%
rename from libclc/generic/include/clc/geometric/floatn.inc
rename to libclc/clc/include/clc/geometric/floatn.inc
index 49c797f9f18458..919c2cadbff4f5 100644
--- a/libclc/generic/include/clc/geometric/floatn.inc
+++ b/libclc/clc/include/clc/geometric/floatn.inc
@@ -1,3 +1,6 @@
+#include <clc/clcfunc.h>
+#include <clc/clctypes.h>
+
 #define __CLC_FLOAT float
 #define __CLC_FPSIZE 32
 

diff  --git a/libclc/clc/include/clc/integer/gentype.inc 
b/libclc/clc/include/clc/integer/gentype.inc
index 2c8dd143db8798..98682a6d32c709 100644
--- a/libclc/clc/include/clc/integer/gentype.inc
+++ b/libclc/clc/include/clc/integer/gentype.inc
@@ -1,3 +1,6 @@
+#include <clc/clcfunc.h>
+#include <clc/clctypes.h>
+
 // These 2 defines only change when switching between data sizes or base types
 // to keep this file manageable.
 #define __CLC_GENSIZE 8

diff  --git a/libclc/clc/include/clc/math/gentype.inc 
b/libclc/clc/include/clc/math/gentype.inc
index 966b4269f66c16..87719f2d9bc0e7 100644
--- a/libclc/clc/include/clc/math/gentype.inc
+++ b/libclc/clc/include/clc/math/gentype.inc
@@ -1,3 +1,6 @@
+#include <clc/clcfunc.h>
+#include <clc/clctypes.h>
+
 #define __CLC_SCALAR_GENTYPE float
 #define __CLC_FPSIZE 32
 

diff  --git a/libclc/clc/include/clc/math/unary_intrin.inc 
b/libclc/clc/include/clc/math/unary_intrin.inc
index c331d3ff08a61d..5ea2246244bef7 100644
--- a/libclc/clc/include/clc/math/unary_intrin.inc
+++ b/libclc/clc/include/clc/math/unary_intrin.inc
@@ -1,3 +1,6 @@
+#include <clc/clcfunc.h>
+#include <clc/clctypes.h>
+
 _CLC_OVERLOAD float __CLC_FUNCTION(float f) __asm(__CLC_INTRINSIC ".f32");
 _CLC_OVERLOAD float2 __CLC_FUNCTION(float2 f) __asm(__CLC_INTRINSIC ".v2f32");
 _CLC_OVERLOAD float3 __CLC_FUNCTION(float3 f) __asm(__CLC_INTRINSIC ".v3f32");

diff  --git a/libclc/clc/include/clc/relational/clc_all.h 
b/libclc/clc/include/clc/relational/clc_all.h
index bf068105aa1be1..7be3d132dd53d0 100644
--- a/libclc/clc/include/clc/relational/clc_all.h
+++ b/libclc/clc/include/clc/relational/clc_all.h
@@ -7,6 +7,7 @@
 #else
 
 #include <clc/clcfunc.h>
+#include <clc/clctypes.h>
 
 #define _CLC_ALL_DECL(TYPE) _CLC_OVERLOAD _CLC_DECL int __clc_all(TYPE v);
 

diff  --git a/libclc/clc/include/clc/relational/clc_any.h 
b/libclc/clc/include/clc/relational/clc_any.h
index f947b77e08341f..27dbffeb2eecd9 100644
--- a/libclc/clc/include/clc/relational/clc_any.h
+++ b/libclc/clc/include/clc/relational/clc_any.h
@@ -7,6 +7,7 @@
 #else
 
 #include <clc/clcfunc.h>
+#include <clc/clctypes.h>
 
 #define _CLC_ANY_DECL(TYPE) _CLC_OVERLOAD _CLC_DECL int __clc_any(TYPE v);
 

diff  --git a/libclc/clc/include/clc/relational/clc_isequal.h 
b/libclc/clc/include/clc/relational/clc_isequal.h
index 3a36ea24fd2994..0f31fb9530a14e 100644
--- a/libclc/clc/include/clc/relational/clc_isequal.h
+++ b/libclc/clc/include/clc/relational/clc_isequal.h
@@ -7,6 +7,7 @@
 #else
 
 #include <clc/clcfunc.h>
+#include <clc/clctypes.h>
 
 #define _CLC_ISEQUAL_DECL(TYPE, RETTYPE)                                       
\
   _CLC_OVERLOAD _CLC_DECL RETTYPE __clc_isequal(TYPE x, TYPE y);

diff  --git a/libclc/clc/include/clc/relational/clc_isinf.h 
b/libclc/clc/include/clc/relational/clc_isinf.h
index c33ef9bb9527d3..3f60bec5654a2e 100644
--- a/libclc/clc/include/clc/relational/clc_isinf.h
+++ b/libclc/clc/include/clc/relational/clc_isinf.h
@@ -7,6 +7,7 @@
 #else
 
 #include <clc/clcfunc.h>
+#include <clc/clctypes.h>
 
 #define _CLC_ISINF_DECL(RET_TYPE, ARG_TYPE)                                    
\
   _CLC_OVERLOAD _CLC_DECL RET_TYPE __clc_isinf(ARG_TYPE);

diff  --git a/libclc/clc/include/clc/relational/clc_isnan.h 
b/libclc/clc/include/clc/relational/clc_isnan.h
index 08351eb5515f9c..3200e593c5cff4 100644
--- a/libclc/clc/include/clc/relational/clc_isnan.h
+++ b/libclc/clc/include/clc/relational/clc_isnan.h
@@ -7,6 +7,7 @@
 #else
 
 #include <clc/clcfunc.h>
+#include <clc/clctypes.h>
 
 #define _CLC_ISNAN_DECL(RET_TYPE, ARG_TYPE)                                    
\
   _CLC_OVERLOAD _CLC_DECL RET_TYPE __clc_isnan(ARG_TYPE);

diff  --git a/libclc/clc/include/clc/relational/floatn.inc 
b/libclc/clc/include/clc/relational/floatn.inc
index fc0d6878b4aa7d..18fb20bd9effee 100644
--- a/libclc/clc/include/clc/relational/floatn.inc
+++ b/libclc/clc/include/clc/relational/floatn.inc
@@ -1,3 +1,5 @@
+#include <clc/clcfunc.h>
+#include <clc/clctypes.h>
 
 #define __CLC_FLOATN float
 #define __CLC_INTN int

diff  --git a/libclc/clc/include/clc/shared/clc_clamp.h 
b/libclc/clc/include/clc/shared/clc_clamp.h
index a84184c1750a58..d9d39413c5618d 100644
--- a/libclc/clc/include/clc/shared/clc_clamp.h
+++ b/libclc/clc/include/clc/shared/clc_clamp.h
@@ -6,9 +6,6 @@
 #define __clc_clamp clamp
 #else
 
-#include <clc/clcfunc.h>
-#include <clc/clctypes.h>
-
 #define __CLC_BODY <clc/shared/clc_clamp.inc>
 #include <clc/integer/gentype.inc>
 


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to