[clang] [HLSL] Default and Relaxed Availability Diagnostics (PR #92704)

Damyan Pepper via cfe-commits cfe-commits at lists.llvm.org
Tue May 28 20:09:18 PDT 2024


================
@@ -345,25 +347,26 @@ class DiagnoseHLSLAvailability
 
   // Helper methods for dealing with current stage context / environment
   void SetShaderStageContext(HLSLShaderAttr::ShaderType ShaderType) {
+    static_assert(HLSLShaderAttr::ShaderTypeMaxValue < 31,
+                  "ShaderType is too big for this bitmap");
     assert((((unsigned)1) << (unsigned)ShaderType) != 0 &&
+           (((unsigned)1) << (unsigned)ShaderType) != 31 &&
----------------
damyanp wrote:

`1 << ` any number can't ever be 31 can it?

Maybe it's meant to be something like:

```suggestion
    assert((((unsigned)1) << (unsigned)ShaderType) != 0 &&
           (unsigned)ShaderType) != 31 &&
```



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


More information about the cfe-commits mailing list