[clang] [HLSL] Add a warning for implicit bindings (PR #135909)
Damyan Pepper via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 16 11:08:38 PDT 2025
================
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -Wno-error=hlsl-implicit-binding -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify
+
+// expected-warning at +1 {{resource has implicit register binding}}
+cbuffer cb0 {
+ int a;
+}
+
+// No warning - this is an element of the $Globals buffer not it's own binding.
+float b;
+
+// expected-warning at +1 {{resource has implicit register binding}}
+RWBuffer<int> c;
+
+// No warning - explicit binding.
+RWBuffer<float> d : register(u0);
+
----------------
damyanp wrote:
How about:
```
RWBuffer<float> dd : register(space1);
```
https://github.com/llvm/llvm-project/pull/135909
More information about the cfe-commits
mailing list