[clang] [HLSL] Add testing for space parameter on global constants (PR #106782)

Damyan Pepper via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 30 12:32:01 PDT 2024


================
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify
+
+
+// expected-error at +1 {{invalid space specifier 's2' used; expected 'space' followed by an integer, like space1}}
+cbuffer a : register(b0, s2) {
+
+}
+
+// expected-error at +1 {{invalid space specifier 'spaces' used; expected 'space' followed by an integer, like space1}}
+cbuffer b : register(b2, spaces) {
+
+}
+
+// expected-error at +1 {{wrong argument format for hlsl attribute, use space3 instead}}
+cbuffer c : register(b2, space 3) {}
+
+// expected-error at +1 {{register space cannot be specified on global constants}}
+int d : register(c2, space3);
----------------
damyanp wrote:

What about:
```
int d2 : register(c2, space00);
```

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


More information about the cfe-commits mailing list