[clang] [HLSL] (DRAFT) Another way to implement #92071: [HLSL] Default linkage of HLSL function should be internal (PR #95331)

Greg Roth via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 25 13:02:57 PDT 2024


================
@@ -119,3 +119,16 @@ behavior between Clang and DXC. Some examples include:
   diagnostic notifying the user of the conversion rather than silently altering
   precision relative to the other overloads (as FXC does) or generating code
   that will fail validation (as DXC does).
+
+Correctness improvements (bug fixes)
+====================================
+
+Entry point functions & ``static`` keyword
+------------------------------------------
+Marking a shader entry point function ``static`` will result in an error.
+
+This is identical to DXC behavior when an entry point is specified as compiler
+argument. However, DXC does not report an error when compiling a shader library
+that has an entry point function with ``[shader("stage")]`` attribute that is
+also marked ``static``. Additionally, this function definition is not included
+in the final DXIL.
----------------
pow2clk wrote:

I'm not sure this is accurate yet. In my experiments with or without this change applied, if I declared an entry function called "main" static, I got a very helpful error, but if I call it "csmain", I get warnings about the useless `shader` and `numthreads` attributes, but otherwise it does just what DXC does. It generates an empty library. I think it _should_ do what is said here. There aren't any tests for that included here. It does seem separable from the rest of this change if you were so inclined. 

https://github.com/llvm/llvm-project/pull/95331


More information about the cfe-commits mailing list