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

Damyan Pepper via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 12 18:09:12 PDT 2024


================
@@ -1,5 +1,24 @@
 // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify
 
+// valid
+cbuffer cbuf {
+    RWBuffer<int> r : register(u0, space0);
+}
+
+cbuffer cbuf2 {
+    struct x {
+        // expected-error at +1 {{'register' attribute only applies to cbuffer/tbuffer and external global variables}}
+        RWBuffer<int> E : register(u2, space3);
+    };
+}
----------------
damyanp wrote:

Presumably we already have a test for this case somewhere else, since the error here is related to the presence of a register attribute at all and not due to register space being there.

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


More information about the cfe-commits mailing list